From bd6566a819bfbbed0a255bf48f7de4ab50970fed Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 8 May 2021 12:26:13 -0400 Subject: [PATCH] Have to clearpacket while holding the lock on snap. Otherwise it can get deleted the moment we unlock it. --- src/zm_monitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 9c58a8ffb..8b977c8b6 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -2304,6 +2304,7 @@ bool Monitor::Analyse() { snap->image = nullptr; } + packetqueue.clearPackets(snap); packetqueue.unlock(packet_lock); if ( snap->image_index > 0 ) { @@ -2314,7 +2315,6 @@ bool Monitor::Analyse() { UpdateAnalysisFPS(); } shared_data->last_read_time = time(nullptr); - packetqueue.clearPackets(snap); return true; } // end Monitor::Analyse