diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2013-06-17 11:53:41 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2013-06-17 11:53:41 -0500 |
commit | 72d74f44b31cefa9d5f4b66d34f9546cb4b40d5a (patch) | |
tree | c0b458a7820be1e36cb805d743346bc1cf348392 | |
parent | a4d5e56e8022cf5e3b22aa8fa2ec5930c2c5c429 (diff) | |
download | ayatana-indicator-power-72d74f44b31cefa9d5f4b66d34f9546cb4b40d5a.tar.gz ayatana-indicator-power-72d74f44b31cefa9d5f4b66d34f9546cb4b40d5a.tar.bz2 ayatana-indicator-power-72d74f44b31cefa9d5f4b66d34f9546cb4b40d5a.zip |
in device-provider-upower's dispose(), disconnect from our proxy's signal before we unref the proxy
-rw-r--r-- | src/device-provider-upower.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/device-provider-upower.c b/src/device-provider-upower.c index 850717e..7cc8858 100644 --- a/src/device-provider-upower.c +++ b/src/device-provider-upower.c @@ -35,7 +35,7 @@ struct _IndicatorPowerDeviceProviderUPowerPriv { DbusUPower * upower_proxy; - GHashTable * devices; + GHashTable * devices; /* dbus object path --> IndicatorPowerDevice */ GCancellable * cancellable; guint timer; }; @@ -67,7 +67,7 @@ G_DEFINE_TYPE_WITH_CODE ( * triggers a device-removed signal, and also a device-changed as the * battery's state changes to 'discharging'. * - * We use a small timer here to fold upower events into a single + * We use a small timer here to fold multiple upower events into a single * IndicatorPowerDeviceProvider devices-changed signal. */ @@ -111,6 +111,8 @@ on_upower_device_proxy_ready (GObject * o, GAsyncResult * res, gpointer gself) } else { + /* use this proxy's properties to update our own IndicatorPowerDevice */ + IndicatorPowerDevice * device; IndicatorPowerDeviceProviderUPower * self; priv_t * p; @@ -295,8 +297,13 @@ my_dispose (GObject * o) p->timer = 0; } - - g_clear_object (&p->upower_proxy); + + if (p->upower_proxy != NULL) + { + g_signal_handlers_disconnect_by_data (p->upower_proxy, self); + + g_clear_object (&p->upower_proxy); + } g_clear_pointer (&p->devices, g_hash_table_destroy); |