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.
parent 1ea4452b
......@@ -731,19 +731,22 @@ fetch_ibus_engines_result (GObject *object,
GAsyncResult *result,
CcRegionPanel *self)
CcRegionPanelPrivate *priv = self->priv;
CcRegionPanelPrivate *priv;
GList *list, *l;
GError *error;
error = NULL;
list = ibus_bus_list_engines_async_finish (priv->ibus, result, &error);
g_clear_object (&priv->ibus_cancellable);
list = ibus_bus_list_engines_async_finish (IBUS_BUS (object), result, &error);
if (!list && error) {
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);
priv = self->priv;
g_clear_object (&priv->ibus_cancellable);
/* 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);
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