From a97a5d30492f793a082269e1ad12cb6d31766aa8 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 21 Jan 2013 17:06:42 -0500 Subject: [PATCH] Don't unconditionally unref potentially NULL objects We already have != NULL checks here, so fold the unrefs inside. --- gtk/gtkplacessidebar.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c index 1bdb1dde0e..c516b4c813 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