From 7de0f46028e964bd7b7979835ef0a80cf8cb01b7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 22 Feb 2019 15:20:52 +0100 Subject: video/widget: fix mutex starvation Get rid of contention in `preview_size' and `set_image'. After switching the Qt mutex to non-recursive, turns out the writer thread preempts the UI thread to the point of freezing the entire thing. Mutex fairness is an implementation detail and we must assume unfair mutexes in the worst case. --- tracker-pt/ftnoir_tracker_pt.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tracker-pt') diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index a1a0dc1c..a2272d1c 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -101,8 +101,7 @@ void Tracker_PT::run() widget->update_image(preview_frame->get_bitmap()); { - int w = -1, h = -1; - widget->get_preview_size(w, h); + auto [ w, h ] = widget->preview_size(); if (w != preview_width || h != preview_height) { preview_width = w; preview_height = h; -- cgit v1.2.3