summaryrefslogtreecommitdiffstats
path: root/src/gdu
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2009-02-17 19:35:52 -0500
committerDavid Zeuthen <davidz@redhat.com>2009-02-17 19:35:52 -0500
commit0984f8c458c16cd6c8805e2cce949cd7da5fc355 (patch)
tree0a4bd784b419c046abed33bbee09411dc4e3ac42 /src/gdu
parent9f4bd12b3842d1bc30d458de378517de8941ce95 (diff)
downloadgnome-disk-utility-0984f8c458c16cd6c8805e2cce949cd7da5fc355.tar.gz
gnome-disk-utility-0984f8c458c16cd6c8805e2cce949cd7da5fc355.tar.xz
gnome-disk-utility-0984f8c458c16cd6c8805e2cce949cd7da5fc355.zip
fix a few memory leaks
Diffstat (limited to 'src/gdu')
-rw-r--r--src/gdu/gdu-drive.c2
-rw-r--r--src/gdu/gdu-linux-md-drive.c2
-rw-r--r--src/gdu/gdu-pool.c19
-rw-r--r--src/gdu/gdu-volume-hole.c2
-rw-r--r--src/gdu/gdu-volume.c2
5 files changed, 17 insertions, 10 deletions
diff --git a/src/gdu/gdu-drive.c b/src/gdu/gdu-drive.c
index 1420385..a34b2f7 100644
--- a/src/gdu/gdu-drive.c
+++ b/src/gdu/gdu-drive.c
@@ -66,6 +66,8 @@ static void device_changed (GduDevice *device, gpointer user_data);
static void
gdu_drive_finalize (GduDrive *drive)
{
+ //g_debug ("finalized drive '%s' %p", drive->priv->id, drive);
+
if (drive->priv->device != NULL) {
g_signal_handlers_disconnect_by_func (drive->priv->device, device_changed, drive);
g_signal_handlers_disconnect_by_func (drive->priv->device, device_job_changed, drive);
diff --git a/src/gdu/gdu-linux-md-drive.c b/src/gdu/gdu-linux-md-drive.c
index 46e7e3a..e7b19de 100644
--- a/src/gdu/gdu-linux-md-drive.c
+++ b/src/gdu/gdu-linux-md-drive.c
@@ -89,6 +89,8 @@ gdu_linux_md_drive_finalize (GObject *object)
{
GduLinuxMdDrive *drive = GDU_LINUX_MD_DRIVE (object);
+ //g_debug ("finalized linux-md drive '%s' %p", drive->priv->id, drive);
+
if (drive->priv->pool != NULL) {
g_signal_handlers_disconnect_by_func (drive->priv->pool, device_added, drive);
g_signal_handlers_disconnect_by_func (drive->priv->pool, device_removed, drive);
diff --git a/src/gdu/gdu-pool.c b/src/gdu/gdu-pool.c
index cad0acb..13125a4 100644
--- a/src/gdu/gdu-pool.c
+++ b/src/gdu/gdu-pool.c
@@ -582,7 +582,7 @@ recompute_presentables (GduPool *pool)
device = GDU_DEVICE (l->data);
- g_debug ("Handling device %s", gdu_device_get_device_file (device));
+ //g_debug ("Handling device %s", gdu_device_get_device_file (device));
/* drives */
if (gdu_device_is_drive (device)) {
@@ -750,7 +750,7 @@ recompute_presentables (GduPool *pool)
for (l = removed_presentables; l != NULL; l = l->next) {
GduPresentable *p = GDU_PRESENTABLE (l->data);
- g_debug ("Removed presentable %s", gdu_presentable_get_id (p));
+ g_debug ("Removed presentable %s %p", gdu_presentable_get_id (p), p);
pool->priv->presentables = g_list_remove (pool->priv->presentables, p);
g_signal_emit (pool, signals[PRESENTABLE_REMOVED], 0, p);
@@ -770,9 +770,9 @@ recompute_presentables (GduPool *pool)
else if (GDU_IS_VOLUME_HOLE (p))
_gdu_volume_hole_rewrite_enclosing_presentable (GDU_VOLUME_HOLE (p));
- g_debug ("Added presentable %s", gdu_presentable_get_id (p));
+ g_debug ("Added presentable %s %p", gdu_presentable_get_id (p), p);
- pool->priv->presentables = g_list_prepend (pool->priv->presentables, p);
+ pool->priv->presentables = g_list_prepend (pool->priv->presentables, g_object_ref (p));
g_signal_emit (pool, signals[PRESENTABLE_ADDED], 0, p);
}
@@ -781,6 +781,8 @@ recompute_presentables (GduPool *pool)
g_list_free (removed_presentables);
g_list_free (added_presentables);
+ g_list_foreach (new_presentables, (GFunc) g_object_unref, NULL);
+ g_list_free (new_presentables);
g_list_foreach (devices, (GFunc) g_object_unref, NULL);
g_list_free (devices);
}
@@ -812,7 +814,7 @@ device_added_signal_handler (DBusGProxy *proxy, const char *object_path, gpointe
(gpointer) gdu_device_get_object_path (device),
device);
g_signal_emit (pool, signals[DEVICE_ADDED], 0, device);
- g_debug ("Added device %s", object_path);
+ //g_debug ("Added device %s", object_path);
recompute_presentables (pool);
@@ -837,7 +839,7 @@ device_removed_signal_handler (DBusGProxy *proxy, const char *object_path, gpoin
g_hash_table_remove (pool->priv->object_path_to_device,
gdu_device_get_object_path (device));
g_signal_emit (pool, signals[DEVICE_REMOVED], 0, device);
- g_debug ("Removed device %s", object_path);
+ //g_debug ("Removed device %s", object_path);
recompute_presentables (pool);
@@ -863,7 +865,7 @@ device_changed_signal_handler (DBusGProxy *proxy, const char *object_path, gpoin
_gdu_device_changed (device);
g_signal_emit (pool, signals[DEVICE_CHANGED], 0, device);
g_object_unref (device);
- g_debug ("Changed device %s", object_path);
+ //g_debug ("Changed device %s", object_path);
recompute_presentables (pool);
@@ -1235,9 +1237,6 @@ device_recurse (GduPool *pool, GduDevice *device, GList **ret, guint depth)
else
*ret = g_list_prepend (*ret, device);
}
-
- out:
- ;
}
/**
diff --git a/src/gdu/gdu-volume-hole.c b/src/gdu/gdu-volume-hole.c
index 747b424..730db78 100644
--- a/src/gdu/gdu-volume-hole.c
+++ b/src/gdu/gdu-volume-hole.c
@@ -62,6 +62,8 @@ G_DEFINE_TYPE_WITH_CODE (GduVolumeHole, gdu_volume_hole, G_TYPE_OBJECT,
static void
gdu_volume_hole_finalize (GduVolumeHole *volume_hole)
{
+ //g_debug ("finalized volume_hole '%s' %p", volume_hole->priv->id, volume_hole);
+
g_object_unref (volume_hole->priv->pool);
if (volume_hole->priv->enclosing_presentable != NULL)
diff --git a/src/gdu/gdu-volume.c b/src/gdu/gdu-volume.c
index 36de08c..0b422d5 100644
--- a/src/gdu/gdu-volume.c
+++ b/src/gdu/gdu-volume.c
@@ -67,6 +67,8 @@ static void device_changed (GduDevice *device, gpointer user_data);
static void
gdu_volume_finalize (GduVolume *volume)
{
+ //g_debug ("finalized volume '%s' %p", volume->priv->id, volume);
+
if (volume->priv->device != NULL) {
g_signal_handlers_disconnect_by_func (volume->priv->device, device_changed, volume);
g_signal_handlers_disconnect_by_func (volume->priv->device, device_job_changed, volume);