summaryrefslogtreecommitdiffstats
path: root/gtk/src
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2014-02-25 18:00:17 +0000
committerjstebbins <[email protected]>2014-02-25 18:00:17 +0000
commitf2e0749bb43ec0f8fc420087100cdfcb2fb0ed59 (patch)
treed1c3b67594c934fe8fd468bc88962ce04c6b38c4 /gtk/src
parent113493ed5cc207301b0bd474707ffcf26769a356 (diff)
LinGui: fix race condition crasher in subtitle/audio lists
clearing a tree view caused selection to change while clearing (and before clearing is complete). The selection change triggered an update that attempted a recursive tree view clear. Since the first clear leaves the tree view in an inconsistant state till it finished, this causes a crash. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6083 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src')
-rw-r--r--gtk/src/audiohandler.c5
-rw-r--r--gtk/src/subtitlehandler.c11
2 files changed, 14 insertions, 2 deletions
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c
index 9fb63a7fa..24742f51d 100644
--- a/gtk/src/audiohandler.c
+++ b/gtk/src/audiohandler.c
@@ -1300,10 +1300,15 @@ ghb_clear_audio_list_ui(GtkBuilder *builder)
{
GtkTreeView *tv;
GtkTreeStore *ts;
+ GtkTreeSelection *tsel;
g_debug("clear_audio_list_ui ()");
tv = GTK_TREE_VIEW(GHB_WIDGET(builder, "audio_list"));
ts = GTK_TREE_STORE(gtk_tree_view_get_model(tv));
+ // Clear tree selection so that updates are not triggered
+ // that cause a recursive attempt to clear the tree selection (crasher)
+ tsel = gtk_tree_view_get_selection(tv);
+ gtk_tree_selection_unselect_all(tsel);
gtk_tree_store_clear(ts);
}
diff --git a/gtk/src/subtitlehandler.c b/gtk/src/subtitlehandler.c
index 2e1318211..f9fe40206 100644
--- a/gtk/src/subtitlehandler.c
+++ b/gtk/src/subtitlehandler.c
@@ -91,7 +91,7 @@ subtitle_refresh_list_row_ui(
if (info_dst_2 == NULL)
info_dst_2 = g_strdup("");
- if(!gtk_tree_model_iter_children(tm, &cti, ti))
+ if (!gtk_tree_model_iter_children(tm, &cti, ti))
{
gtk_tree_store_append(GTK_TREE_STORE(tm), &cti, ti);
}
@@ -104,7 +104,7 @@ subtitle_refresh_list_row_ui(
}
else
{
- if(gtk_tree_model_iter_children(tm, &cti, ti))
+ if (gtk_tree_model_iter_children(tm, &cti, ti))
{
gtk_tree_store_remove(GTK_TREE_STORE(tm), &cti);
}
@@ -567,6 +567,8 @@ ghb_set_pref_subtitle(const hb_title_t *title, signal_user_data_t *ud)
ghb_clear_subtitle_list_ui(ud->builder);
if (title == NULL)
{
+ // Clear the subtitle list
+ ghb_clear_subtitle_list_settings(ud->settings);
return;
}
sub_count = hb_list_count(title->list_subtitle);
@@ -978,9 +980,14 @@ ghb_clear_subtitle_list_ui(GtkBuilder *builder)
{
GtkTreeView *tv;
GtkTreeStore *ts;
+ GtkTreeSelection *tsel;
tv = GTK_TREE_VIEW(GHB_WIDGET(builder, "subtitle_list"));
ts = GTK_TREE_STORE(gtk_tree_view_get_model(tv));
+ // Clear tree selection so that updates are not triggered
+ // that cause a recursive attempt to clear the tree selection (crasher)
+ tsel = gtk_tree_view_get_selection(tv);
+ gtk_tree_selection_unselect_all(tsel);
gtk_tree_store_clear(ts);
}