[vlc-devel] commit: skins2: replacement for vlc_object_find_name no longer operational (Erwan Tulou )
git version control
git at videolan.org
Tue Aug 25 10:16:10 CEST 2009
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Tue Aug 25 08:25:26 2009 +0200| [f0270d5506d5e23c1545f05fd14ce0d03047c52b] | committer: Erwan Tulou
skins2: replacement for vlc_object_find_name no longer operational
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f0270d5506d5e23c1545f05fd14ce0d03047c52b
---
modules/gui/qt4/menus.cpp | 9 +++------
modules/gui/skins2/src/skin_main.cpp | 26 ++++++++++++++++++--------
2 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 2a91f8b..bc7f231 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -972,11 +972,10 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
/* In skins interface, append some items */
if( !mi )
{
-
- vlc_object_t *p_object = ( vlc_object_t* )
- vlc_object_find_name( p_intf, "skins2", FIND_PARENT );
- if( p_object )
+ if( p_intf->p_sys->b_isDialogProvider )
{
+ vlc_object_t* p_object = p_intf->p_parent;
+
objects.clear(); varnames.clear();
objects.push_back( p_object );
varnames.push_back( "intf-skins" );
@@ -986,8 +985,6 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
objects.push_back( p_object );
varnames.push_back( "intf-skins-interactive" );
Populate( p_intf, submenu, varnames, objects );
-
- vlc_object_release( p_object );
}
else
msg_Warn( p_intf, "could not find parent interface" );
diff --git a/modules/gui/skins2/src/skin_main.cpp b/modules/gui/skins2/src/skin_main.cpp
index 086e935..4c6bbbc 100644
--- a/modules/gui/skins2/src/skin_main.cpp
+++ b/modules/gui/skins2/src/skin_main.cpp
@@ -125,6 +125,9 @@ static int Open( vlc_object_t *p_this )
// Create a variable to be notified of skins to be loaded
var_Create( p_intf, "skin-to-load", VLC_VAR_STRING );
+ vlc_mutex_init( &p_intf->p_sys->vout_lock );
+ vlc_cond_init( &p_intf->p_sys->vout_wait );
+
vlc_mutex_init( &p_intf->p_sys->init_lock );
vlc_cond_init( &p_intf->p_sys->init_wait );
@@ -135,8 +138,11 @@ static int Open( vlc_object_t *p_this )
VLC_THREAD_PRIORITY_LOW ) )
{
vlc_mutex_unlock( &p_intf->p_sys->init_lock );
+
vlc_cond_destroy( &p_intf->p_sys->init_wait );
vlc_mutex_destroy( &p_intf->p_sys->init_lock );
+ vlc_cond_destroy( &p_intf->p_sys->vout_wait );
+ vlc_mutex_destroy( &p_intf->p_sys->vout_lock );
pl_Release( p_intf->p_sys->p_playlist );
free( p_intf->p_sys );
return VLC_EGENERIC;
@@ -150,9 +156,6 @@ static int Open( vlc_object_t *p_this )
skin_load.intf = p_intf;
vlc_mutex_unlock( &skin_load.mutex );
- vlc_mutex_init( &p_intf->p_sys->vout_lock );
- vlc_cond_init( &p_intf->p_sys->vout_wait );
-
return VLC_SUCCESS;
}
@@ -358,28 +361,33 @@ static vlc_mutex_t serializer = VLC_STATIC_MUTEX;
// Callbacks for vout requests
static int WindowOpen( vlc_object_t *p_this )
{
+ int i_ret;
vout_window_t *pWnd = (vout_window_t *)p_this;
- intf_thread_t *pIntf = (intf_thread_t *)
- vlc_object_find_name( p_this, "skins2", FIND_ANYWHERE );
+
+ vlc_mutex_lock( &skin_load.mutex );
+ intf_thread_t *pIntf = skin_load.intf;
+ if( pIntf )
+ vlc_object_hold( pIntf );
+ vlc_mutex_unlock( &skin_load.mutex );
if( pIntf == NULL )
return VLC_EGENERIC;
- vlc_object_release( pIntf );
-
vlc_mutex_lock( &serializer );
pWnd->handle.hwnd = VoutManager::getWindow( pIntf, pWnd );
if( pWnd->handle.hwnd )
{
- pWnd->sys = (vout_window_sys_t*)pIntf;
pWnd->control = &VoutManager::controlWindow;
+ pWnd->sys = (vout_window_sys_t*)pIntf;
+
vlc_mutex_unlock( &serializer );
return VLC_SUCCESS;
}
else
{
+ vlc_object_release( pIntf );
vlc_mutex_unlock( &serializer );
return VLC_EGENERIC;
}
@@ -391,6 +399,8 @@ static void WindowClose( vlc_object_t *p_this )
intf_thread_t *pIntf = (intf_thread_t *)pWnd->sys;
VoutManager::releaseWindow( pIntf, pWnd );
+
+ vlc_object_release( pIntf );
}
//---------------------------------------------------------------------------
More information about the vlc-devel
mailing list