diff options
author | Ted Gould <ted@gould.cx> | 2011-01-31 08:58:18 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-01-31 08:58:18 -0600 |
commit | 6a6a292ffadadf9f5389fe0c8507ef047daffce1 (patch) | |
tree | 97c0c1e7c6a3837222cea768139c7d89b0cfb413 /libdbusmenu-glib | |
parent | 35265154f7d70dc31837ff8fe4e45a810c393c2b (diff) | |
download | libdbusmenu-6a6a292ffadadf9f5389fe0c8507ef047daffce1.tar.gz libdbusmenu-6a6a292ffadadf9f5389fe0c8507ef047daffce1.tar.bz2 libdbusmenu-6a6a292ffadadf9f5389fe0c8507ef047daffce1.zip |
Keep a ref to the client through-out the call to the update
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r-- | libdbusmenu-glib/client.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index b196c9f..f59dcf6 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1553,11 +1553,6 @@ update_layout_cb (GObject * proxy, GAsyncResult * res, gpointer data) DbusmenuClient * client = DBUSMENU_CLIENT(data); DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); - if (priv->layoutcall != NULL) { - g_object_unref(priv->layoutcall); - priv->layoutcall = NULL; - } - GError * error = NULL; GVariant * params = NULL; @@ -1566,7 +1561,7 @@ update_layout_cb (GObject * proxy, GAsyncResult * res, gpointer data) if (error != NULL) { g_warning("Getting layout failed: %s", error->message); g_error_free(error); - return; + goto out; } guint rev; @@ -1580,7 +1575,7 @@ update_layout_cb (GObject * proxy, GAsyncResult * res, gpointer data) if (parseable == 0) { g_warning("Unable to parse layout!"); - return; + goto out; } priv->my_revision = rev; @@ -1596,6 +1591,13 @@ update_layout_cb (GObject * proxy, GAsyncResult * res, gpointer data) update_layout(client); } +out: + if (priv->layoutcall != NULL) { + g_object_unref(priv->layoutcall); + priv->layoutcall = NULL; + } + + g_object_unref(G_OBJECT(client)); return; } @@ -1622,6 +1624,7 @@ update_layout (DbusmenuClient * client) priv->layoutcall = g_cancellable_new(); + g_object_ref(G_OBJECT(client)); g_dbus_proxy_call(priv->menuproxy, "GetLayout", g_variant_new("(i)", 0), /* root */ |