]> git.sesse.net Git - vlc/blobdiff - modules/gui/beos/ListViews.cpp
playlist: Make sure we don't pl_Release(p_playlist).
[vlc] / modules / gui / beos / ListViews.cpp
index 74f677c9fb54c02a9d767de6a17929ff3a243f7c..2822915f80ac392d2f209309659fd0c039037581 100644 (file)
@@ -23,7 +23,6 @@
 
 #if 0
 
-#include <stdio.h>
 #include <malloc.h>
 
 #include <Bitmap.h>
 #include <String.h>
 
 /* VLC headers */
-#include <vlc/vlc.h>
-#include <vlc/intf.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_interface.h>
 
 #include "InterfaceWindow.h"
 #include "ListViews.h"
@@ -250,12 +253,12 @@ DragSortableListView::InitiateDrag( BPoint point, int32 index, bool )
                 v->SetHighColor( 0, 0, 0, 255 );
                 v->StrokeRect( v->Bounds() );
                 v->Sync();
-    
                 uint8 *bits = (uint8 *)dragBitmap->Bits();
                 int32 height = (int32)dragBitmap->Bounds().Height() + 1;
                 int32 width = (int32)dragBitmap->Bounds().Width() + 1;
                 int32 bpr = dragBitmap->BytesPerRow();
-    
                 if (fade) {
                     for ( int32 y = 0; y < height - ALPHA / 2; y++, bits += bpr ) {
                         uint8 *line = bits + 3;
@@ -370,7 +373,7 @@ DragSortableListView::MouseMoved(BPoint where, uint32 transit, const BMessage *m
                     // offset where by half of item height
                     BRect r( ItemFrame( 0 ) );
                     where.y += r.Height() / 2.0;
-    
                     int32 index = IndexOf( where );
                     if ( index < 0 )
                         index = CountItems();
@@ -687,13 +690,11 @@ PlaylistView::MouseDown( BPoint where )
                 // only do something if user clicked the same item twice
                 if ( fLastClickedItem == item )
                 {
-                    playlist_t * p_playlist;
-                    p_playlist = (playlist_t *) vlc_object_find( p_intf,
-                        VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+                    playlist_t * p_playlist = pl_Yield( p_intf );
                     if( p_playlist )
                     {
                         playlist_Goto( p_playlist, i );
-                        vlc_object_release( p_playlist );
+                        pl_Release( p_intf );
                     }
                     handled = true;
                 }
@@ -728,7 +729,7 @@ PlaylistView::KeyDown( const char* bytes, int32 numBytes )
 {
     if ( numBytes < 1 )
         return;
-        
     if ( ( bytes[0] == B_BACKSPACE ) || ( bytes[0] == B_DELETE ) )
     {
         RemoveSelected();
@@ -845,7 +846,7 @@ PlaylistView::CopyItems( BList& items, int32 toIndex )
             void* cloned = fVlcWrapper->PlaylistCloneItem( item );
             if ( cloned && !clonedItems.AddItem( cloned ) )
                 free( cloned );
-            
         }
         // add cloned items at index
         int32 index = toIndex;
@@ -1046,7 +1047,7 @@ PlaylistView::SortReverse()
 void
 PlaylistView::SortByPath()
 {
-    
 }
 
 /*****************************************************************************
@@ -1076,9 +1077,7 @@ PlaylistView::SetDisplayMode( uint32 mode )
 BListItem*
 PlaylistView::_PlayingItem() const
 {
-    playlist_t * p_playlist;
-    p_playlist = (playlist_t *) vlc_object_find( p_intf,
-        VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+    playlist_t * p_playlist = pl_Yield( p_intf );
 
     if( !p_playlist )
     {
@@ -1086,7 +1085,7 @@ PlaylistView::_PlayingItem() const
     }
 
     BListItem * item = ItemAt( p_playlist->i_index );
-    vlc_object_release( p_playlist );
+    pl_Release( p_intf );
     return item;
 }
 
@@ -1100,10 +1099,8 @@ PlaylistView::_SetPlayingIndex( BListItem* playingItem )
     {
         if ( item == playingItem )
         {
-            playlist_t * p_playlist;
-            p_playlist = (playlist_t *) vlc_object_find( p_intf,
-                VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
-        
+            playlist_t * p_playlist = pl_Yield( p_intf );
             if( !p_playlist )
             {
                 return;
@@ -1112,7 +1109,7 @@ PlaylistView::_SetPlayingIndex( BListItem* playingItem )
             playlist_Goto( p_playlist, i );
             SetCurrent( i );
 
-            vlc_object_release( p_playlist );
+            pl_Release( p_intf );
             break;
         }
     }