]> git.sesse.net Git - vlc/blobdiff - modules/video_output/msw/events.c
Use pl_Release with the right argument.
[vlc] / modules / video_output / msw / events.c
index 8ee36bf5a455830614b3db3d5a5afd0b6906f58d..60af482f5f9ecbb316253ac027b20855a3d7a4aa 100644 (file)
@@ -77,11 +77,9 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args );
 
 static void DirectXPopupMenu( event_thread_t *p_event, bool b_open )
 {
-    playlist_t *p_playlist = pl_Yield( p_event );
     vlc_value_t val;
     val.b_bool = b_open;
-    var_Set( p_playlist, "intf-popupmenu", val );
-    vlc_object_release( p_playlist );
+    var_Set( p_event->p_libvlc, "intf-popupmenu", val );
 }
 
 static int DirectXConvertKey( int i_key );
@@ -109,10 +107,7 @@ void EventThread( event_thread_t *p_event )
     /* Creating a window under Windows also initializes the thread's event
      * message queue */
     if( DirectXCreateWindow( p_event->p_vout ) )
-    {
-        msg_Err( p_event, "out of memory" );
         p_event->b_dead = true;
-    }
 
     /* Signal the creation of the window */
     vlc_thread_ready( p_event );
@@ -136,10 +131,10 @@ void EventThread( event_thread_t *p_event )
 
     /* Main loop */
     /* GetMessage will sleep if there's no message in the queue */
-    while( !p_event->b_die && GetMessage( &msg, 0, 0, 0 ) )
+    while( vlc_object_alive (p_event) && GetMessage( &msg, 0, 0, 0 ) )
     {
         /* Check if we are asked to exit */
-        if( p_event->b_die )
+        if( !vlc_object_alive (p_event) )
             break;
 
         switch( msg.message )
@@ -867,8 +862,11 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
     case WM_CLOSE:
     {
         playlist_t * p_playlist = pl_Yield( p_vout );
-        playlist_Stop( p_playlist );
-        vlc_object_release( p_playlist );
+        if( p_playlist )
+        {
+            playlist_Stop( p_playlist );
+            pl_Release( p_vout );
+        }
         return 0;
     }