From eff97fd55f7f31103fa588a6a431a1e22c50c77e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 1 Mar 2016 07:58:12 -0500 Subject: [PATCH] Take a reference on the im context for async ops This might fix the crash in yelp that some people continue to see. https://bugzilla.gnome.org/show_bug.cgi?id=762887 --- gtk/gtkimcontextsimple.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c index 8237ea445e..897770d6c0 100644 --- a/gtk/gtkimcontextsimple.c +++ b/gtk/gtkimcontextsimple.c @@ -232,16 +232,12 @@ init_compose_table_thread_cb (GTask *task, gpointer task_data, GCancellable *cancellable) { - GtkIMContextSimple *im_context_simple; - if (g_task_return_error_if_cancelled (task)) return; g_return_if_fail (GTK_IS_IM_CONTEXT_SIMPLE (task_data)); - im_context_simple = GTK_IM_CONTEXT_SIMPLE (task_data); - - gtk_im_context_simple_init_compose_table (im_context_simple); + gtk_im_context_simple_init_compose_table (GTK_IM_CONTEXT_SIMPLE (task_data)); } void @@ -252,7 +248,7 @@ init_compose_table_async (GtkIMContextSimple *im_context_simple, { GTask *task = g_task_new (NULL, cancellable, callback, user_data); g_task_set_source_tag (task, init_compose_table_async); - g_task_set_task_data (task, im_context_simple, NULL); + g_task_set_task_data (task, g_object_ref (im_context_simple), g_object_unref); g_task_run_in_thread (task, init_compose_table_thread_cb); g_object_unref (task); }