Fix crash on Linux (and maybe others).
authorCarl Hetherington <cth@carlh.net>
Tue, 3 Nov 2020 23:15:30 +0000 (00:15 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 3 Nov 2020 23:15:30 +0000 (00:15 +0100)
Calling _canvas->SetCurrent() without the canvas being on screen
causes a crash on Linux (and maybe elsewhere).

src/wx/gl_video_view.cc

index 79ede0d8e843d8fee59dd7f51802552e1a5d9e68..d3388282181bba2073a66278d260ac0863f587b0 100644 (file)
@@ -112,16 +112,17 @@ GLVideoView::check_for_butler_errors ()
 void
 GLVideoView::update ()
 {
-       if (!_thread.joinable()) {
-               _thread = boost::thread (boost::bind(&GLVideoView::thread, this));
-       }
-
        {
                boost::mutex::scoped_lock lm (_canvas_mutex);
                if (!_canvas->IsShownOnScreen()) {
                        return;
                }
        }
+
+       if (!_thread.joinable()) {
+               _thread = boost::thread (boost::bind(&GLVideoView::thread, this));
+       }
+
        request_one_shot ();
 }