[vlc-commits] [Git][videolan/vlc][master] qt: fix interface state locking on MacOS

Rémi Denis-Courmont (@Courmisch) gitlab at videolan.org
Fri Sep 9 18:47:55 UTC 2022



Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC


Commits:
4241b31f by Alexandre Janniaux at 2022-09-09T18:33:34+00:00
qt: fix interface state locking on MacOS

On most platforms, the Qt interface is started in its own thread and the
VLC interface startup routine needs to wait for the Qt interface to be
ready before giving the control back to libvlc.

On MacOS, the interface is currently started into the main thread
directly because of the platform constraints of Qt, blocking libvlc and
enforcing the startup of Qt synchronously.

Because of that, the state lock was never given back, and the window,
started from a different thread, was never able to lock it to check that
the interface is correctly started.

The correct fix should be to make the Qt interface start correctly as in
other platforms, but current attempts at making it a reality have
failed. In particular, it doesn't seem possible to dispatch the startup.
The changes here keep the current workaround, allowing application
developers to check the behaviour on MacOS.

- - - - -


1 changed file:

- modules/gui/qt/qt.cpp


Changes:

=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -498,6 +498,7 @@ static int OpenInternal( qt_intf_t *p_intf )
     /* Get the playlist before the lock to avoid a lock-order-inversion */
     vlc_playlist_t *playlist = vlc_intf_GetMainPlaylist(p_intf->intf);
 
+#ifndef Q_OS_MAC
     vlc::threads::mutex_locker locker (lock);
     if (busy || open_state == OPEN_STATE_ERROR)
     {
@@ -505,6 +506,7 @@ static int OpenInternal( qt_intf_t *p_intf )
             msg_Err (p_intf, "cannot start Qt multiple times");
         return VLC_EGENERIC;
     }
+#endif
 
     p_intf->p_mi = NULL;
 
@@ -834,7 +836,6 @@ static void *Thread( void *obj )
     /* Explain how to show a dialog :D */
     p_intf->pf_show_dialog = ShowDialog;
 
-#ifndef Q_OS_MAC
     /* Tell the main LibVLC thread we are ready */
     {
         vlc::threads::mutex_locker locker (lock);
@@ -843,7 +844,7 @@ static void *Thread( void *obj )
         open_state = OPEN_STATE_OPENED;
         wait_ready.signal();
     }
-#else
+#ifdef Q_OS_MAC
     /* We took over main thread, register and start here */
     if( !p_intf->b_isDialogProvider )
     {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/4241b31f00a806bf10a55c6ea33c96d604a05d9f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/4241b31f00a806bf10a55c6ea33c96d604a05d9f
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list