[vlc-devel] commit: fb: Cleanup properly after failing OpenDisplay. (Jean-Paul Saman )

git version control git at videolan.org
Wed Feb 11 16:48:52 CET 2009


vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Wed Feb 11 16:17:38 2009 +0100| [a0b49d79a0da09aedf7f0bed2f6cadb593cac8bc] | committer: Jean-Paul Saman 

fb: Cleanup properly after failing OpenDisplay.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a0b49d79a0da09aedf7f0bed2f6cadb593cac8bc
---

 modules/video_output/fb.c |   37 ++++++++++++++++---------------------
 1 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/modules/video_output/fb.c b/modules/video_output/fb.c
index 092b621..602a888 100644
--- a/modules/video_output/fb.c
+++ b/modules/video_output/fb.c
@@ -361,15 +361,7 @@ static int Create( vlc_object_t *p_this )
 
     if( OpenDisplay( p_vout ) )
     {
-        if( p_sys->b_tty )
-        {
-            ioctl( p_sys->i_tty, VT_SETMODE, &p_vout->p_sys->vt_mode );
-            sigaction( SIGUSR1, &p_vout->p_sys->sig_usr1, NULL );
-            sigaction( SIGUSR2, &p_vout->p_sys->sig_usr2, NULL );
-            tcsetattr(0, 0, &p_vout->p_sys->old_termios);
-            TextMode( p_sys->i_tty );
-        }
-        free( p_vout->p_sys );
+        Destroy( VLC_OBJECT(p_vout) );
         return VLC_EGENERIC;
     }
 
@@ -959,21 +951,24 @@ static void CloseDisplay( vout_thread_t *p_vout )
         munmap( p_vout->p_sys->p_video, p_vout->p_sys->i_page_size );
     }
 
-    /* Restore palette */
-    if( p_vout->p_sys->var_info.bits_per_pixel == 8 )
+    if( p_vout->p_sys->i_fd >= 0 )
     {
-        ioctl( p_vout->p_sys->i_fd,
-               FBIOPUTCMAP, &p_vout->p_sys->fb_cmap );
-        free( p_vout->p_sys->p_palette );
-        p_vout->p_sys->p_palette = NULL;
-    }
+        /* Restore palette */
+        if( p_vout->p_sys->var_info.bits_per_pixel == 8 )
+        {
+            ioctl( p_vout->p_sys->i_fd,
+                   FBIOPUTCMAP, &p_vout->p_sys->fb_cmap );
+            free( p_vout->p_sys->p_palette );
+            p_vout->p_sys->p_palette = NULL;
+        }
 
-    /* Restore fb config */
-    ioctl( p_vout->p_sys->i_fd,
-           FBIOPUT_VSCREENINFO, &p_vout->p_sys->old_info );
+        /* Restore fb config */
+        ioctl( p_vout->p_sys->i_fd,
+               FBIOPUT_VSCREENINFO, &p_vout->p_sys->old_info );
 
-    /* Close fb */
-    close( p_vout->p_sys->i_fd );
+        /* Close fb */
+        close( p_vout->p_sys->i_fd );
+    }
 }
 
 /*****************************************************************************




More information about the vlc-devel mailing list