diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2012-03-28 16:09:07 -0700 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2012-03-28 16:09:07 -0700 |
commit | e36470f01af8d5196f0ba1d98f6ac7b8f1ced3b4 (patch) | |
tree | ab64d83cf8d25a2af4c60eb891b8a03970044afb /src/datetime-prefs.c | |
parent | ed69123d5f8fff8b793cfa7bdae91e6082506ebf (diff) | |
parent | 5261e7f898e82ef03e5e8658253ae0c111d5870e (diff) | |
download | ayatana-indicator-datetime-e36470f01af8d5196f0ba1d98f6ac7b8f1ced3b4.tar.gz ayatana-indicator-datetime-e36470f01af8d5196f0ba1d98f6ac7b8f1ced3b4.tar.bz2 ayatana-indicator-datetime-e36470f01af8d5196f0ba1d98f6ac7b8f1ced3b4.zip |
* New upstream release.
* Fix g-c-c crash caused by datetime's prefs panel (LP: #942450)
* Fix several memory leaks in datetime's preferences page (LP: #965533)
Diffstat (limited to 'src/datetime-prefs.c')
-rw-r--r-- | src/datetime-prefs.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c index bfe75c0..fbb8ea1 100644 --- a/src/datetime-prefs.c +++ b/src/datetime-prefs.c @@ -70,6 +70,8 @@ struct _IndicatorDatetimePanelPrivate gboolean changing_time; GtkWidget * loc_dlg; CcTimezoneCompletion * completion; + GCancellable * tz_query_cancel; + GCancellable * ntp_query_cancel; }; struct _IndicatorDatetimePanelClass @@ -214,6 +216,8 @@ ntp_query_answered (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * GError * error = NULL; GVariant * answers = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error); + g_clear_object (&self->priv->ntp_query_cancel); + if (error != NULL) { g_warning("Could not query DBus proxy for SettingsDaemon: %s", error->message); g_error_free(error); @@ -265,6 +269,8 @@ tz_query_answered (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * GError * error = NULL; GVariant * answers = g_dbus_proxy_call_finish (G_DBUS_PROXY (object), res, &error); + g_clear_object (&self->priv->tz_query_cancel); + if (error != NULL) { g_warning("Could not query DBus proxy for SettingsDaemon: %s", error->message); g_error_free(error); @@ -286,6 +292,7 @@ static void proxy_ready (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * self) { GError * error = NULL; + IndicatorDatetimePanelPrivate * priv = self->priv; self->priv->proxy = g_dbus_proxy_new_for_bus_finish (res, &error); @@ -296,10 +303,16 @@ proxy_ready (GObject *object, GAsyncResult *res, IndicatorDatetimePanel * self) } /* And now, do initial proxy configuration */ - g_dbus_proxy_call (self->priv->proxy, "GetUsingNtp", NULL, G_DBUS_CALL_FLAGS_NONE, -1, - NULL, (GAsyncReadyCallback)ntp_query_answered, self); - g_dbus_proxy_call (self->priv->proxy, "GetTimezone", NULL, G_DBUS_CALL_FLAGS_NONE, -1, - NULL, (GAsyncReadyCallback)tz_query_answered, self); + if (priv->ntp_query_cancel == NULL) { + priv->ntp_query_cancel = g_cancellable_new(); + g_dbus_proxy_call (priv->proxy, "GetUsingNtp", NULL, G_DBUS_CALL_FLAGS_NONE, -1, + priv->ntp_query_cancel, (GAsyncReadyCallback)ntp_query_answered, self); + } + if (priv->tz_query_cancel == NULL); { + priv->tz_query_cancel = g_cancellable_new(); + g_dbus_proxy_call (priv->proxy, "GetTimezone", NULL, G_DBUS_CALL_FLAGS_NONE, -1, + priv->tz_query_cancel, (GAsyncReadyCallback)tz_query_answered, self); + } } static void @@ -784,6 +797,16 @@ indicator_datetime_panel_dispose (GObject * object) g_clear_object (&priv->builder); g_clear_object (&priv->proxy); + if (priv->tz_query_cancel != NULL) { + g_cancellable_cancel (priv->tz_query_cancel); + g_clear_object (&priv->tz_query_cancel); + } + + if (priv->ntp_query_cancel != NULL) { + g_cancellable_cancel (priv->ntp_query_cancel); + g_clear_object (&priv->ntp_query_cancel); + } + if (priv->loc_dlg) { gtk_widget_destroy (priv->loc_dlg); priv->loc_dlg = NULL; |