summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Li <gary.li1@uwaterloo.ca>2023-03-10 23:12:18 -0500
committerCorey Berla <corey@berla.me>2023-04-20 13:44:55 +0000
commitc02b2204c7c74356a8d547be852e889113201ec1 (patch)
tree289a5b701bfc5cd62b5503133af09e7b4981b7ca
parent59cb3c4529c5a8827d976179a1f4d1777852aea1 (diff)
downloadnautilus-c02b2204c7c74356a8d547be852e889113201ec1.tar.gz
nautilusgtkplacessidebar: simplify setter logic with g_set_object
Use g_set_object to simplify setter logic and avoid issues if current_location == location.
-rw-r--r--src/gtk/nautilusgtkplacessidebar.c6
1 files changed, 1 insertions, 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;