Rename locked_packet to packet_lock. Don't unlock packet as it crashes

This commit is contained in:
Isaac Connor
2026-01-15 12:44:40 -05:00
parent aec37d423f
commit cb09b2201a

View File

@@ -731,12 +731,12 @@ void Event::Run() {
// The idea is to process the queue no matter what so that all packets get processed.
// We only break if the queue is empty
while (!terminate_ and !zm_terminate) {
ZMPacketLock locked_packet = packetqueue->get_packet_no_wait(packetqueue_it);
std::shared_ptr<ZMPacket> packet = locked_packet.packet_;
ZMPacketLock packet_lock = packetqueue->get_packet_no_wait(packetqueue_it);
std::shared_ptr<ZMPacket> packet = packet_lock.packet_;
if (packet) {
if (!packet->decoded) {
Debug(1, "Not decoded");
packet->unlock();
packet_lock.unlock();
// Stay behind decoder
Microseconds sleep_for = Microseconds(ZM_SAMPLE_RATE);
Debug(4, "Sleeping for %" PRId64 "us", int64(sleep_for.count()));
@@ -762,8 +762,6 @@ void Event::Run() {
packet->analysis_image = nullptr;
}
} // end if packet->image
Debug(1, "Deleting packet lock");
packet->unlock();
// Important not to increment it until after we are done with the packet because clearPackets checks for iterators pointing to it.
packetqueue->increment_it(packetqueue_it);
} else {