summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2017-07-05 10:57:30 -0700
committerJohn Stebbins <[email protected]>2017-07-05 10:58:10 -0700
commit9148528a2a2d8c944ecc7a589b059a45418244d1 (patch)
treef2e386bb1576915bfbb6d8550f9ed0e2d22930d6
parent63e20c1d2c79792c092fbe943a0fd5a9d49e6958 (diff)
LinGui: fix use of freed memory in "File" menu action
Fixes https://github.com/HandBrake/HandBrake/issues/807
-rw-r--r--gtk/src/callbacks.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index 2ee6431f5..89aa9740c 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -1387,6 +1387,9 @@ do_source_dialog(GtkButton *button, gboolean single, signal_user_data_t *ud)
title_id = ghb_dict_get_int(ud->settings, "single_title");
else
title_id = 0;
+ // ghb_do_scan replaces "scan_source" key in dict, so we must
+ // be finished with sourcename before calling ghb_do_scan
+ // since the memory it references will be freed
if (strcmp(sourcename, filename) != 0)
{
ghb_dict_set_string(ud->prefs, "default_source", filename);
@@ -1426,15 +1429,18 @@ dvd_source_activate_cb(GtkWidget *widget, signal_user_data_t *ud)
const gchar *filename;
const gchar *sourcename;
+ // ghb_do_scan replaces "scan_source" key in dict, so we must
+ // be finished with sourcename before calling ghb_do_scan
+ // since the memory it references will be freed
sourcename = ghb_dict_get_string(ud->globals, "scan_source");
filename = gtk_buildable_get_name(GTK_BUILDABLE(widget));
- ghb_do_scan(ud, filename, 0, TRUE);
if (strcmp(sourcename, filename) != 0)
{
ghb_dict_set_string(ud->prefs, "default_source", filename);
ghb_pref_save(ud->prefs, "default_source");
ghb_dvd_set_current(filename, ud);
}
+ ghb_do_scan(ud, filename, 0, TRUE);
}
void