[gtk+/places-sidebar] Don't unconditionally unref potentially NULL objects



commit a97a5d30492f793a082269e1ad12cb6d31766aa8
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Jan 21 17:06:42 2013 -0500

    Don't unconditionally unref potentially NULL objects
    
    We already have != NULL checks here, so fold the unrefs inside.

 gtk/gtkplacessidebar.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 1bdb1dd..c516b4c 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -2499,8 +2499,8 @@ rescan_shortcut_cb (GtkMenuItem           *item,
 
 	if (drive != NULL) {
 		g_drive_poll_for_media (drive, NULL, drive_poll_for_media_cb, sidebar);
+		g_object_unref (drive);
 	}
-	g_object_unref (drive);
 }
 
 static void
@@ -2553,8 +2553,8 @@ start_shortcut_cb (GtkMenuItem           *item,
 		g_drive_start (drive, G_DRIVE_START_NONE, mount_op, NULL, drive_start_cb, sidebar);
 
 		g_object_unref (mount_op);
+		g_object_unref (drive);
 	}
-	g_object_unref (drive);
 }
 
 static void
@@ -2605,9 +2605,10 @@ stop_shortcut_cb (GtkMenuItem           *item,
 		mount_op = get_unmount_operation (sidebar);
 		g_drive_stop (drive, G_MOUNT_UNMOUNT_NONE, mount_op, NULL, drive_stop_cb,
 			      g_object_ref (sidebar));
+
 		g_object_unref (mount_op);
+		g_object_unref (drive);
 	}
-	g_object_unref (drive);
 }
 
 static gboolean



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