summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Berla <corey@berla.me>2023-05-11 17:46:25 -0700
committerCorey Berla <corey@berla.me>2023-05-11 17:46:25 -0700
commite16201b761f4879a0793b0fae8bd77990d06017d (patch)
treece277b2abbdbce74f9a39d7cf81d9fbba687b4a6
parentfdb95bdeec7e50ccce6c9095e77c9a86cfa02059 (diff)
downloadnautilus-wip/corey/placesviewcrash.tar.gz
gtkplacesview: Clear row_for_action when row is gonewip/corey/placesviewcrash
row_for_action is set when a row is right clicked (upon opening the popup). The previous row_for_action object data is also cleared during this process. If however, the row has disappeared (from an unmount outside of gtkplacesview, such as the sidebar or physical removal), we attempt to set object data on an invalid object. Set row_for_action as a weak pointer to avoid this situation. See: https://bugzilla.redhat.com/show_bug.cgi?id=2188733
-rw-r--r--src/gtk/nautilusgtkplacesview.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gtk/nautilusgtkplacesview.c b/src/gtk/nautilusgtkplacesview.c
index e48ed22e4..1e3c89d84 100644
--- a/src/gtk/nautilusgtkplacesview.c
+++ b/src/gtk/nautilusgtkplacesview.c
@@ -434,6 +434,7 @@ nautilus_gtk_places_view_dispose (GObject *object)
g_cancellable_cancel (view->cancellable);
g_cancellable_cancel (view->networks_fetching_cancellable);
g_clear_pointer (&view->popup_menu, gtk_widget_unparent);
+ g_clear_weak_pointer (&view->row_for_action);
G_OBJECT_CLASS (nautilus_gtk_places_view_parent_class)->dispose (object);
}
@@ -1376,7 +1377,6 @@ unmount_ready_cb (GObject *source_mount,
return;
}
- view->row_for_action = NULL;
view->unmounting_mount = FALSE;
update_loading (view);
@@ -1817,7 +1817,7 @@ real_popup_menu (GtkWidget *widget,
&(GdkRectangle){x_in_view, y_in_view, 0, 0});
}
- view->row_for_action = row;
+ g_set_weak_pointer (&view->row_for_action, row);
if (view->row_for_action)
g_object_set_data (G_OBJECT (view->row_for_action), "menu", view->popup_menu);