]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwidgets/timer.cpp
playlist: Make sure we don't pl_Release(p_playlist).
[vlc] / modules / gui / wxwidgets / timer.cpp
index 50555e61c39bc29fb56a1a5d65fe96ce3293599e..f65b090f0c671b98911a54b70180f4189c448449 100644 (file)
@@ -18,7 +18,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -46,32 +46,20 @@ Timer::Timer( intf_thread_t *_p_intf, Interface *_p_main_interface )
     p_main_interface = _p_main_interface;
     b_init = 0;
 
+    var_AddCallback( p_intf->p_libvlc, "intf-show", IntfShowCB, p_intf );
+
     /* Register callback for the intf-popupmenu variable */
-    playlist_t *p_playlist =
-        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                       FIND_ANYWHERE );
-    if( p_playlist != NULL )
-    {
-        var_AddCallback( p_playlist, "intf-popupmenu", PopupMenuCB, p_intf );
-        var_AddCallback( p_playlist, "intf-show", IntfShowCB, p_intf );
-        vlc_object_release( p_playlist );
-    }
+    var_AddCallback( p_intf->p_libvlc, "intf-popupmenu", PopupMenuCB, p_intf );
 
     Start( 100 /*milliseconds*/, wxTIMER_CONTINUOUS );
 }
 
 Timer::~Timer()
 {
+    var_DelCallback( p_intf->p_libvlc, "intf-show", IntfShowCB, p_intf );
+
     /* Unregister callback */
-    playlist_t *p_playlist =
-        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                       FIND_ANYWHERE );
-    if( p_playlist != NULL )
-    {
-        var_DelCallback( p_playlist, "intf-popupmenu", PopupMenuCB, p_intf );
-        var_DelCallback( p_playlist, "intf-show", IntfShowCB, p_intf );
-        vlc_object_release( p_playlist );
-    }
+    var_DelCallback( p_intf->p_libvlc, "intf-popupmenu", PopupMenuCB, p_intf );
 }
 
 /*****************************************************************************
@@ -90,7 +78,7 @@ void Timer::Notify()
     if( !b_init )
     {
         p_main_interface->Init();
-        b_init = VLC_TRUE;
+        b_init = true;
     }
 #endif
 
@@ -104,10 +92,11 @@ void Timer::Notify()
     if( p_intf->p_sys->b_intf_show )
     {
         p_main_interface->Raise();
-        p_intf->p_sys->b_intf_show = VLC_FALSE;
+        p_main_interface->Show();
+        p_intf->p_sys->b_intf_show = false;
     }
 
-    if( p_intf->b_die )
+    if( intf_ShouldDie( p_intf ) )
     {
         vlc_mutex_unlock( &p_intf->change_lock );
 
@@ -146,7 +135,7 @@ static int IntfShowCB( vlc_object_t *p_this, const char *psz_variable,
                        vlc_value_t old_val, vlc_value_t new_val, void *param )
 {
     intf_thread_t *p_intf = (intf_thread_t *)param;
-    p_intf->p_sys->b_intf_show = VLC_TRUE;
+    p_intf->p_sys->b_intf_show = true;
 
     return VLC_SUCCESS;
 }