changeset 18066:2ee39341b7a6

fix segfault in the skin browser when sbSelectedSkin gets dereferenced before setting, when no skin is selected in the skin list upon opening the browser, and "Cancel" or "OK" buttons get clicked. Noticed when runnig freshly compiled gmplayer on a system where the skins were still under the old location. based on a combined patch by Stanislav Maslovski <stanislav POIS maslovski AH gmail POIS com>
author gpoirier
date Sun, 09 Apr 2006 13:52:45 +0000
parents f275cd6c7fc8
children ac7eaa0313c2
files Gui/mplayer/gtk/sb.c
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/mplayer/gtk/sb.c	Sun Apr 09 13:49:37 2006 +0000
+++ b/Gui/mplayer/gtk/sb.c	Sun Apr 09 13:52:45 2006 +0000
@@ -24,8 +24,8 @@
 char      * sbMPlayerPrefixDir=NULL;
 char      * sbMPlayerPrefixDir_obsolete=NULL;
 
-char * gtkOldSkin;
-static char * prev;
+char * gtkOldSkin=NULL;
+static char * prev=NULL;
 
 GtkWidget * SkinBrowser = NULL;
 
@@ -77,9 +77,11 @@
 
 static void prButton( GtkObject * object,gpointer user_data )
 {
- switch ( (int)user_data )
-  {
-   case 0: // cancel
+ if ( sbSelectedSkin )
+ {
+  switch ( (int)user_data )
+   {
+    case 0: // cancel
 	if ( strcmp( sbSelectedSkin,gtkOldSkin ) ) ChangeSkin( gtkOldSkin );
 	break;
    case 1: // ok
@@ -88,6 +90,7 @@
 	skinName=strdup( sbSelectedSkin );
 	break;   
   }
+ }
  HideSkinBrowser();
 }