From c02b2204c7c74356a8d547be852e889113201ec1 Mon Sep 17 00:00:00 2001 From: Gary Li Date: Fri, 10 Mar 2023 23:12:18 -0500 Subject: nautilusgtkplacessidebar: simplify setter logic with g_set_object Use g_set_object to simplify setter logic and avoid issues if current_location == location. --- src/gtk/nautilusgtkplacessidebar.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/gtk/nautilusgtkplacessidebar.c b/src/gtk/nautilusgtkplacessidebar.c index 193c50d72..cccd24e46 100644 --- a/src/gtk/nautilusgtkplacessidebar.c +++ b/src/gtk/nautilusgtkplacessidebar.c @@ -4611,11 +4611,7 @@ nautilus_gtk_places_sidebar_set_location (NautilusGtkPlacesSidebar *sidebar, gtk_list_box_unselect_all (GTK_LIST_BOX (sidebar->list_box)); - if (sidebar->current_location != NULL) - g_object_unref (sidebar->current_location); - sidebar->current_location = location; - if (sidebar->current_location != NULL) - g_object_ref (sidebar->current_location); + g_set_object (&sidebar->current_location, location); if (location == NULL) goto out; -- cgit v1.2.1