aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-04-07 13:29:38 -0500
committerTed Gould <ted@gould.cx>2011-04-07 13:29:38 -0500
commite4e135fabfa23dbedef35587333568322f6dafe6 (patch)
tree9b479e958716835d12652acc9f3d44e332dc349f
parent108f239625577a43667aeb40f02803704bf961f5 (diff)
parentf57f2e78ccd66ed1fc4dc83f74ee3bdc2ed510e7 (diff)
downloadayatana-indicator-application-e4e135fabfa23dbedef35587333568322f6dafe6.tar.gz
ayatana-indicator-application-e4e135fabfa23dbedef35587333568322f6dafe6.tar.bz2
ayatana-indicator-application-e4e135fabfa23dbedef35587333568322f6dafe6.zip
Handle async cancels
-rw-r--r--src/application-service-appstore.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c
index 25eba69..3e827d5 100644
--- a/src/application-service-appstore.c
+++ b/src/application-service-appstore.c
@@ -432,7 +432,6 @@ got_all_properties (GObject * source_object, GAsyncResult * res,
g_return_if_fail(app != NULL);
GError * error = NULL;
- ApplicationServiceAppstorePrivate * priv = app->appstore->priv;
GVariant * menu = NULL, * id = NULL, * category = NULL,
* status = NULL, * icon_name = NULL, * aicon_name = NULL,
* icon_desc = NULL, * aicon_desc = NULL,
@@ -441,6 +440,11 @@ got_all_properties (GObject * source_object, GAsyncResult * res,
GVariant * properties = g_dbus_proxy_call_finish(G_DBUS_PROXY(source_object), res, &error);
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ g_error_free (error);
+ return; // Must exit before accessing freed memory
+ }
+
if (app->props_cancel != NULL) {
g_object_unref(app->props_cancel);
app->props_cancel = NULL;
@@ -454,6 +458,8 @@ got_all_properties (GObject * source_object, GAsyncResult * res,
return;
}
+ ApplicationServiceAppstorePrivate * priv = app->appstore->priv;
+
/* Grab all properties from variant */
GVariantIter * iter = NULL;
const gchar * name = NULL;
@@ -1043,6 +1049,11 @@ dbus_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data)
GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish(res, &error);
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ g_error_free (error);
+ return; // Must exit before accessing freed memory
+ }
+
if (app->dbus_proxy_cancel != NULL) {
g_object_unref(app->dbus_proxy_cancel);
app->dbus_proxy_cancel = NULL;
@@ -1437,6 +1448,12 @@ approver_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data)
g_return_if_fail(approver != NULL);
GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish(res, &error);
+
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ g_error_free (error);
+ return; // Must exit before accessing freed memory
+ }
+
ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE (approver->appstore);
if (approver->proxy_cancel != NULL) {