summaryrefslogtreecommitdiffstats
path: root/gtk/src/callbacks.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2013-02-01 19:29:55 +0000
committerjstebbins <[email protected]>2013-02-01 19:29:55 +0000
commit478574ed1d6161a49212d29ff3911dfad15da5f3 (patch)
tree6e1c4f4884b1037b10a312cab68040a88111b594 /gtk/src/callbacks.c
parenta47fd8fc599f9abf4e53bafe8cec33b1de466f0c (diff)
LinGui: fix crash caused by bug in newer versions of gtk2
GtkCombobBoxText is not initialized correctly by gtk2. Reading out it's current value fails and returns NULL. So explicitely initialize the text column value and guard against future bugs by checking return value. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5231 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/callbacks.c')
-rw-r--r--gtk/src/callbacks.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index 8971e48a4..eb98553e3 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -833,12 +833,16 @@ dvd_device_changed_cb(GtkComboBoxText *combo, signal_user_data_t *ud)
gchar *name;
dialog = GHB_WIDGET(ud->builder, "source_dialog");
- device = gtk_combo_box_text_get_active_text (combo);
- name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(dialog));
- if (name == NULL || strcmp(name, device) != 0)
- gtk_file_chooser_select_filename (GTK_FILE_CHOOSER(dialog), device);
- if (name != NULL)
- g_free(name);
+ device = gtk_combo_box_text_get_active_text(combo);
+ // Protext against unexpected NULL return value
+ if (device != NULL)
+ {
+ name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(dialog));
+ if (name == NULL || strcmp(name, device) != 0)
+ gtk_file_chooser_select_filename (GTK_FILE_CHOOSER(dialog), device);
+ if (name != NULL)
+ g_free(name);
+ }
}
}