[rhythmbox] mtp: don't leak udev_device



commit b3b25e8a54955281779d9058de16aecff93d0729
Author: Christophe Fergeau <cfergeau mandriva com>
Date:   Wed Mar 24 11:28:20 2010 +0100

    mtp: don't leak udev_device
    
    udev_device was leaked when the MTP source object was finalized. Also
    set remount_volume to NULL when disposing the source.

 plugins/mtpdevice/rb-mtp-source.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/plugins/mtpdevice/rb-mtp-source.c b/plugins/mtpdevice/rb-mtp-source.c
index bff85e9..cc8167d 100644
--- a/plugins/mtpdevice/rb-mtp-source.c
+++ b/plugins/mtpdevice/rb-mtp-source.c
@@ -484,12 +484,14 @@ rb_mtp_source_dispose (GObject *object)
 #if defined(HAVE_GUDEV)
 	if (priv->remount_volume != NULL) {
 		rb_debug ("remounting gvfs volume for mtp device");
+		/* the callback will unref remount_volume */
 		g_volume_mount (priv->remount_volume,
 				G_MOUNT_MOUNT_NONE,
 				NULL,
 				NULL,
 				remount_done_cb,
 				NULL);
+		priv->remount_volume = NULL;
 	}
 #endif
 
@@ -514,7 +516,11 @@ rb_mtp_source_finalize (GObject *object)
 	g_hash_table_destroy (priv->artwork_request_map);
 	g_hash_table_destroy (priv->track_transfer_map);		/* probably need to destroy the tracks too.. */
 
-#if !defined(HAVE_GUDEV)
+#if defined(HAVE_GUDEV)
+	if (priv->udev_device) {
+		g_object_unref (G_OBJECT (priv->udev_device));
+	}
+#else
 	g_free (priv->udi);
 #endif
 	g_free (priv->manufacturer);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]