Commit 8dbd9ed5 authored by Cosimo Cecchi's avatar Cosimo Cecchi Committed by Rui Matos
Browse files

region: don't access priv pointer before checking no error

If the GCancellable is cancelled by the finalize() function, the
callback will still be called potentially with an instance of the
panel that's not valid anymore.
To avoid crashing in that case, only access the priv pointer
when we have no error.

https://bugzilla.gnome.org/show_bug.cgi?id=761846
parent 1ea4452b
...@@ -731,19 +731,22 @@ fetch_ibus_engines_result (GObject *object, ...@@ -731,19 +731,22 @@ fetch_ibus_engines_result (GObject *object,
GAsyncResult *result, GAsyncResult *result,
CcRegionPanel *self) CcRegionPanel *self)
{ {
CcRegionPanelPrivate *priv = self->priv; CcRegionPanelPrivate *priv;
GList *list, *l; GList *list, *l;
GError *error; GError *error;
error = NULL; error = NULL;
list = ibus_bus_list_engines_async_finish (priv->ibus, result, &error); list = ibus_bus_list_engines_async_finish (IBUS_BUS (object), result, &error);
g_clear_object (&priv->ibus_cancellable);
if (!list && error) { if (!list && error) {
g_warning ("Couldn't finish IBus request: %s", error->message); if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_warning ("Couldn't finish IBus request: %s", error->message);
g_error_free (error); g_error_free (error);
return; return;
} }
priv = self->priv;
g_clear_object (&priv->ibus_cancellable);
/* Maps engine ids to engine description objects */ /* Maps engine ids to engine description objects */
priv->ibus_engines = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); priv->ibus_engines = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment