changeset 33785:0c42fbe235d3

Fix segmentation fault. In case a subtitle codepage or subtitle font encoding is given that does not match any of the encodings the GUI knows about, the preferences dialog crashes.
author ib
date Mon, 11 Jul 2011 12:32:03 +0000
parents 72adb79f5a16
children 0d3d8db05a59
files gui/ui/gtk/preferences.c
diffstat 1 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/gui/ui/gtk/preferences.c	Mon Jul 11 11:19:44 2011 +0000
+++ b/gui/ui/gtk/preferences.c	Mon Jul 11 12:32:03 2011 +0000
@@ -177,8 +177,6 @@
   { "cp874",       MSGTR_PREFERENCES_FontEncoding20 },
   { NULL,NULL }
  };
-char * lCEncoding = NULL;
-char * lSEncoding = NULL;
 #endif
 
 static int    old_audio_driver = 0;
@@ -324,8 +322,7 @@
    int i;
    for ( i=0;lEncoding[i].name;i++ )
     if ( !gstrcmp( sub_cp,lEncoding[i].name ) ) break;
-   if ( lEncoding[i].name ) lSEncoding=lEncoding[i].comment;
-   gtk_entry_set_text( GTK_ENTRY( ESubEncoding ),lSEncoding );
+   if ( lEncoding[i].name ) gtk_entry_set_text( GTK_ENTRY( ESubEncoding ),lEncoding[i].comment );
   }
 #endif
 
@@ -344,8 +341,7 @@
    int i;
    for ( i=0;lEncoding[i].name;i++ )
     if ( !gstrcmp( subtitle_font_encoding,lEncoding[i].name ) ) break;
-   if ( lEncoding[i].name ) lCEncoding=lEncoding[i].comment;
-   gtk_entry_set_text( GTK_ENTRY( EFontEncoding ),lCEncoding );
+   if ( lEncoding[i].name ) gtk_entry_set_text( GTK_ENTRY( EFontEncoding ),lEncoding[i].comment );
   }
  switch ( subtitle_autoscale )
   {