[gnome-control-center] region: don't access priv pointer before checking no error
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] region: don't access priv pointer before checking no error
- Date: Thu, 11 Feb 2016 19:04:54 +0000 (UTC)
commit 8dbd9ed592770eaa498ad835d4d322b0dd38810d
Author: Cosimo Cecchi <cosimo endlessm com>
Date: Wed Feb 10 18:17:59 2016 -0800
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
panels/region/cc-region-panel.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/panels/region/cc-region-panel.c b/panels/region/cc-region-panel.c
index f4d9241..f1b3356 100644
--- a/panels/region/cc-region-panel.c
+++ b/panels/region/cc-region-panel.c
@@ -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) {
- 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);
return;
}
+ 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]