]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/playlistinfo.m
* fixed a bug which prevented the fspanel to show up in some circumstances. Patch...
[vlc] / modules / gui / macosx / playlistinfo.m
index 3b5384e362f117d8e3a83428805280a42d722d2c..83c11b375b7b62c2faffbb3016ce1788f1922b97 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  r playlistinfo.m: MacOS X interface module
  *****************************************************************************
- * Copyright (C) 2002-2006 the VideoLAN team
+ * Copyright (C) 2002-2007 the VideoLAN team
  * $Id$
  *
  * Authors: Benjamin Pracht <bigben at videolan dot org>
     [super dealloc];
 }
 
+#if GC_ENABLED
+- (void)finalize
+{
+    /* since dealloc isn't called with enabled GC on 10.5, we need this to prevent core crashes */
+    if( [o_statUpdateTimer isValid] )
+        [o_statUpdateTimer invalidate];
+    [super finalize];
+}
+#endif
+    
 - (IBAction)togglePlaylistInfoPanel:(id)sender
 {
     if( [o_info_window isVisible] )
     else
     {
         intf_thread_t * p_intf = VLCIntf;
-        playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                          FIND_ANYWHERE );
-
-        if( p_playlist )
-        {
-            p_item = p_playlist->status.p_item;
-            vlc_object_release( p_playlist );
-        }
+        playlist_t * p_playlist = pl_Yield( p_intf );
 
+        p_item = p_playlist->status.p_item;
+        vlc_object_release( p_playlist );
+        
         [self initPanel:sender];
     }
 }
 {
     /* make sure that we got the current item and not an outdated one */
     intf_thread_t * p_intf = VLCIntf;
-        playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                          FIND_ANYWHERE );
+        playlist_t * p_playlist = pl_Yield( p_intf );
 
-    if( p_playlist )
-    {
-        p_item = p_playlist->status.p_item;
-        vlc_object_release( p_playlist );
-    }
+    p_item = p_playlist->status.p_item;
+    vlc_object_release( p_playlist );
 
     /* check whether our item is valid, because we would crash if not */
     if(! [self isItemInPlaylist: p_item] ) return;
 - (IBAction)infoOk:(id)sender
 {
     intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                          FIND_ANYWHERE );
+    playlist_t * p_playlist = pl_Yield( p_intf );
     vlc_value_t val;
 
     if( [self isItemInPlaylist: p_item] )
 - (BOOL)isItemInPlaylist:(playlist_item_t *)p_local_item
 {
     intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                          FIND_ANYWHERE );
+    playlist_t * p_playlist = pl_Yield( p_intf );
     int i;
 
-    if( p_playlist == NULL )
-    {
-        return NO;
-    }
-
-    for( i = 0 ; i < p_playlist->i_all_size ; i++ )
+    for( i = 0 ; i < p_playlist->all_items.i_size ; i++ )
     {
-        if( p_playlist->pp_all_items[i] == p_local_item )
+        if( ARRAY_VAL( p_playlist->all_items, i ) == p_local_item )
         {
             vlc_object_release( p_playlist );
             return YES;
@@ -430,7 +425,8 @@ static VLCInfoTreeItem *o_root_item = nil;
 }
 
 + (VLCInfoTreeItem *)rootItem {
-    if (o_root_item == nil) o_root_item = [[VLCInfoTreeItem alloc] initWithName:@"main" value: @"" ID: 0 parent:nil];
+    if( o_root_item == nil )
+        o_root_item = [[VLCInfoTreeItem alloc] initWithName:@"main" value: @"" ID: 0 parent:nil];
     return o_root_item;
 }