X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fmisc%2Fqte_main.cpp;h=05ab4b4290418d013b99e5a5591d4525582c4e74;hb=a76e38e103fb6e405b218c61ef475ca85223262e;hp=ea9510523145445c0e3351b88397faab982ffa4d;hpb=3561b9b28f58eb7a4183e158a8fd973800d31ceb;p=vlc diff --git a/modules/misc/qte_main.cpp b/modules/misc/qte_main.cpp index ea95105231..05ab4b4290 100644 --- a/modules/misc/qte_main.cpp +++ b/modules/misc/qte_main.cpp @@ -56,7 +56,7 @@ typedef struct qte_thread_t static int Open ( vlc_object_t * ); static void Close ( vlc_object_t * ); -static void QteMain ( qte_thread_t * ); +static void* QteMain( vlc_object_t * ); /***************************************************************************** * Local variables (mutex-protected). @@ -72,29 +72,29 @@ static qte_thread_t * p_qte_main = NULL; "Qt/Embedded GUI Server. This option is equivalent to the -qws option " \ "from normal Qt.") -vlc_module_begin(); - set_description( N_("Qt Embedded GUI helper") ); - set_capability( "gui-helper", 90 ); - add_bool( "qte-guiserver", 0, NULL, STANDALONE_TEXT, STANDALONE_LONGTEXT, false ); - add_shortcut( "qte" ); - set_callbacks( Open, Close ); -vlc_module_end(); +vlc_module_begin () + set_description( N_("Qt Embedded GUI helper") ) + set_capability( "gui-helper", 90 ) + add_bool( "qte-guiserver", 0, NULL, STANDALONE_TEXT, STANDALONE_LONGTEXT, false ) + add_shortcut( "qte" ) + set_callbacks( Open, Close ) +vlc_module_end () } /* extern "C" */ +static vlc_mutex_t qte_lock = VLC_STATIC_MUTEX; + /***************************************************************************** * Open: initialize and create window *****************************************************************************/ static int Open( vlc_object_t *p_this ) { - vlc_mutex_t *lock; - - lock = var_AcquireMutex( "qte" ); + vlc_mutex_lock( &qte_lock ); if( i_refcount > 0 ) { i_refcount++; - vlc_mutex_unlock( lock ); + vlc_mutex_unlock( &qte_lock ); return VLC_SUCCESS; } @@ -113,7 +113,7 @@ static int Open( vlc_object_t *p_this ) } i_refcount++; - vlc_mutex_unlock( lock ); + vlc_mutex_unlock( &qte_lock ); vlc_object_attach( p_qte_main, p_this ); msg_Dbg( p_this, "qte_main running" ); @@ -126,9 +126,7 @@ static int Open( vlc_object_t *p_this ) *****************************************************************************/ static void Close( vlc_object_t *p_this ) { - vlc_mutex_t *lock; - - lock = var_AcquireMutex( "qte" ); + vlc_mutex_lock( &qte_lock ); i_refcount--; @@ -149,7 +147,7 @@ static void Close( vlc_object_t *p_this ) vlc_object_release( p_qte_main ); p_qte_main = NULL; - vlc_mutex_unlock( lock ); + vlc_mutex_unlock( &qte_lock ); } /***************************************************************************** @@ -158,9 +156,11 @@ static void Close( vlc_object_t *p_this ) * this part of the interface is in a separate thread so that we can call * qte_main() from within it without annoying the rest of the program. *****************************************************************************/ -static void QteMain( qte_thread_t *p_this ) +static void* QteMain( vlc_object_t* p_vlc_obj ) { + qte_thread_t *p_this = (qte_thread_t*)p_vlc_obj; int i_argc = 1; + int canc = vlc_savecancel (); p_this->b_gui_server = false; if( config_GetInt( p_this, "qte-guiserver" ) ) @@ -189,4 +189,7 @@ static void QteMain( qte_thread_t *p_this ) vlc_thread_ready( p_this ); p_this->p_qte_application->exec(); + + vlc_restorecancel (canc); + return NULL; }