Commit 2b35ca91 authored by Marvin Scholz's avatar Marvin Scholz Committed by Thomas Guillem
Browse files

qt: do not try to lock non-existent thread

On macOS the qt interface does not spawn a thread but instead runs
on the main thread, so taking the locks here would lead to a deadlock.
parent e343f829
...@@ -502,8 +502,10 @@ static int Open( vlc_object_t *p_this, bool isDialogProvider ) ...@@ -502,8 +502,10 @@ static int Open( vlc_object_t *p_this, bool isDialogProvider )
/* Wait for the interface to be ready. This prevents the main /* Wait for the interface to be ready. This prevents the main
* LibVLC thread from starting video playback before we can create * LibVLC thread from starting video playback before we can create
* an embedded video window. */ * an embedded video window. */
#ifndef Q_OS_MAC
while (open_state == OPEN_STATE_INIT) while (open_state == OPEN_STATE_INIT)
wait_ready.wait(lock); wait_ready.wait(lock);
#endif
if (open_state == OPEN_STATE_ERROR) if (open_state == OPEN_STATE_ERROR)
{ {
...@@ -717,14 +719,14 @@ static void *Thread( void *obj ) ...@@ -717,14 +719,14 @@ static void *Thread( void *obj )
/* Explain how to show a dialog :D */ /* Explain how to show a dialog :D */
p_intf->pf_show_dialog = ShowDialog; p_intf->pf_show_dialog = ShowDialog;
#ifndef Q_OS_MAC
/* Tell the main LibVLC thread we are ready */ /* Tell the main LibVLC thread we are ready */
{ {
vlc::threads::mutex_locker locker (lock); vlc::threads::mutex_locker locker (lock);
open_state = OPEN_STATE_OPENED; open_state = OPEN_STATE_OPENED;
wait_ready.signal(); wait_ready.signal();
} }
#else
#ifdef Q_OS_MAC
/* We took over main thread, register and start here */ /* We took over main thread, register and start here */
if( !p_sys->b_isDialogProvider ) if( !p_sys->b_isDialogProvider )
{ {
...@@ -765,11 +767,15 @@ static void *ThreadCleanup( intf_thread_t *p_intf, bool error ) ...@@ -765,11 +767,15 @@ static void *ThreadCleanup( intf_thread_t *p_intf, bool error )
intf_sys_t *p_sys = p_intf->p_sys; intf_sys_t *p_sys = p_intf->p_sys;
{ {
#ifndef Q_OS_MAC
vlc::threads::mutex_locker locker (lock); vlc::threads::mutex_locker locker (lock);
#endif
if( error ) if( error )
{ {
open_state = OPEN_STATE_ERROR; open_state = OPEN_STATE_ERROR;
#ifndef Q_OS_MAC
wait_ready.signal(); wait_ready.signal();
#endif
} }
else else
open_state = OPEN_STATE_INIT; open_state = OPEN_STATE_INIT;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment