I can't convince myself that _canvas_mutex is doing anything useful, so remove it.
authorCarl Hetherington <cth@carlh.net>
Thu, 22 Apr 2021 23:10:19 +0000 (01:10 +0200)
committerCarl Hetherington <cth@carlh.net>
Thu, 22 Apr 2021 23:10:19 +0000 (01:10 +0200)
src/wx/gl_video_view.cc
src/wx/gl_video_view.h

index bda3a58ec38a4a570c1208e28fef4ac8ed7c4bf4..7bf9e3adc6d8e880403a601f5b268c6e21bffeba 100644 (file)
@@ -122,20 +122,18 @@ GLVideoView::check_for_butler_errors ()
 }
 
 
+/** Called from the UI thread */
 void
 GLVideoView::update ()
 {
-       {
-               boost::mutex::scoped_lock lm (_canvas_mutex);
-               if (!_canvas->IsShownOnScreen()) {
-                       return;
-               }
+       if (!_canvas->IsShownOnScreen()) {
+               return;
+       }
 
 #ifdef DCPOMATIC_OSX
-               /* macOS gives errors if we don't do this (and therefore [NSOpenGLContext setView:]) from the main thread */
-               ensure_context ();
+       /* macOS gives errors if we don't do this (and therefore [NSOpenGLContext setView:]) from the main thread */
+       ensure_context ();
 #endif
-       }
 
        if (!_thread.joinable()) {
                _thread = boost::thread (boost::bind(&GLVideoView::thread, this));
@@ -262,7 +260,6 @@ DCPOMATIC_ENABLE_WARNINGS
        glFlush();
        check_gl_error ("glFlush");
 
-       boost::mutex::scoped_lock lm (_canvas_mutex);
        _canvas->SwapBuffers();
 }
 
@@ -364,23 +361,19 @@ try
 {
        start_of_thread ("GLVideoView");
 
-       {
-               boost::mutex::scoped_lock lm (_canvas_mutex);
-
 #if defined(DCPOMATIC_OSX)
-               /* Without this we see errors like
-                * ../src/osx/cocoa/glcanvas.mm(194): assert ""context"" failed in SwapBuffers(): should have current context [in thread 700006970000]
-                */
-               WXGLSetCurrentContext (_context->GetWXGLContext());
+       /* Without this we see errors like
+        * ../src/osx/cocoa/glcanvas.mm(194): assert ""context"" failed in SwapBuffers(): should have current context [in thread 700006970000]
+        */
+       WXGLSetCurrentContext (_context->GetWXGLContext());
 #else
-               /* We must call this here on Linux otherwise we get no image (for reasons
-                * that aren't clear).  However, doing ensure_context() from this thread
-                * on macOS gives
-                * "[NSOpenGLContext setView:] must be called from the main thread".
-                */
-               ensure_context ();
+       /* We must call this here on Linux otherwise we get no image (for reasons
+        * that aren't clear).  However, doing ensure_context() from this thread
+        * on macOS gives
+        * "[NSOpenGLContext setView:] must be called from the main thread".
+        */
+       ensure_context ();
 #endif
-       }
 
 #if defined(DCPOMATIC_LINUX) && defined(DCPOMATIC_HAVE_GLX_SWAP_INTERVAL_EXT)
        if (_canvas->IsExtensionSupported("GLX_EXT_swap_control")) {
index 4601eb02de00ce0370f19f9c9cf7fbc2042ccca1..36edd6b8b979111285a7df2dcc4421efbd37c0f1 100644 (file)
@@ -64,10 +64,6 @@ private:
        void ensure_context ();
        void size_changed (wxSizeEvent const &);
 
-       /* Mutex for use of _canvas; it's only contended when our ::thread
-          is started up so this may be overkill.
-        */
-       boost::mutex _canvas_mutex;
        wxGLCanvas* _canvas;
        wxGLContext* _context;