summaryrefslogtreecommitdiff
path: root/src/up-device.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-11-18 10:12:56 +0100
committerPeter Wu <peter@lekensteyn.nl>2014-11-18 10:30:51 +0100
commita8366e2a6a3f013d527bbba912eee0e59f08224b (patch)
treead8484fed457f7e2be0daa5cea3bfce969419618 /src/up-device.c
parent20076ab59ee4ff46bf24488d112515c16a54657a (diff)
downloadupower-daemon-mess.tar.gz
[WIP] attempt to fix refcount leak of UpDaemondaemon-mess
Debug in GDB with: break up-main.c:260 # just after daemon = up_daemon_new () p &daemon->parent.ref_count break *(guint *)ADDR_PRINTED_ABOVE commands bt c end c Refcount of daemon was over 100 at the end...
Diffstat (limited to 'src/up-device.c')
-rw-r--r--src/up-device.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/up-device.c b/src/up-device.c
index 685be80..40c4c6b 100644
--- a/src/up-device.c
+++ b/src/up-device.c
@@ -722,6 +722,19 @@ bail:
}
/**
+ * up_device_unplug:
+ *
+ * Initiates destruction of %UpDevice, undoing the effects of
+ * up_device_coldplug.
+ */
+void
+up_device_unplug (UpDevice *device)
+{
+ if (device->priv->daemon != NULL)
+ g_object_unref (device->priv->daemon);
+}
+
+/**
* up_device_register_display_device:
**/
gboolean
@@ -1042,8 +1055,6 @@ up_device_finalize (GObject *object)
g_return_if_fail (device->priv != NULL);
if (device->priv->native != NULL)
g_object_unref (device->priv->native);
- if (device->priv->daemon != NULL)
- g_object_unref (device->priv->daemon);
if (device->priv->props_idle_id != 0)
g_source_remove (device->priv->props_idle_id);
g_object_unref (device->priv->history);