[nautilus/wip/coreyberla/window-dispose: 7/7] placessidebar: Don't unreferece the trash monitor
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/coreyberla/window-dispose: 7/7] placessidebar: Don't unreferece the trash monitor
- Date: Thu, 1 Sep 2022 20:27:34 +0000 (UTC)
commit 1437c4498089547ec8e59b412720ae8b2855ce72
Author: António Fernandes <antoniof gnome org>
Date: Thu Sep 1 19:39:53 2022 +0100
placessidebar: Don't unreferece the trash monitor
Using g_clear_object() we release a reference which we never aquired.
This causes crashes.
So, don't do that. And going a step futher: don't even keep a pointer
nor a singal id: just use g_signal_connect_object() and enjoy peace.
src/gtk/nautilusgtkplacessidebar.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
---
diff --git a/src/gtk/nautilusgtkplacessidebar.c b/src/gtk/nautilusgtkplacessidebar.c
index 792afea53..2ae34fba6 100644
--- a/src/gtk/nautilusgtkplacessidebar.c
+++ b/src/gtk/nautilusgtkplacessidebar.c
@@ -113,7 +113,6 @@ struct _NautilusGtkPlacesSidebar {
GList *unready_accounts;
GVolumeMonitor *volume_monitor;
- NautilusTrashMonitor *trash_monitor;
GtkSettings *gtk_settings;
GFile *current_location;
@@ -123,7 +122,6 @@ struct _NautilusGtkPlacesSidebar {
GtkWidget *rename_error;
char *rename_uri;
- gulong trash_monitor_changed_id;
GtkWidget *trash_row;
/* DND */
@@ -3901,9 +3899,9 @@ nautilus_gtk_places_sidebar_init (NautilusGtkPlacesSidebar *sidebar)
sidebar->bookmarks_manager = _nautilus_gtk_bookmarks_manager_new ((GtkBookmarksChangedFunc)update_places,
sidebar);
- sidebar->trash_monitor = nautilus_trash_monitor_get ();
- sidebar->trash_monitor_changed_id = g_signal_connect_swapped (sidebar->trash_monitor,
"trash-state-changed",
- G_CALLBACK (update_trash_icon), sidebar);
+ g_signal_connect_object (nautilus_trash_monitor_get (), "trash-state-changed",
+ G_CALLBACK (update_trash_icon), sidebar,
+ G_CONNECT_SWAPPED);
sidebar->swin = gtk_scrolled_window_new ();
gtk_widget_set_parent (sidebar->swin, GTK_WIDGET (sidebar));
@@ -4125,13 +4123,6 @@ nautilus_gtk_places_sidebar_dispose (GObject *object)
sidebar->rename_error = NULL;
}
- if (sidebar->trash_monitor)
- {
- g_signal_handler_disconnect (sidebar->trash_monitor, sidebar->trash_monitor_changed_id);
- sidebar->trash_monitor_changed_id = 0;
- g_clear_object (&sidebar->trash_monitor);
- }
-
if (sidebar->trash_row)
{
g_object_remove_weak_pointer (G_OBJECT (sidebar->trash_row),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]