From 3434cb86b4a292da136bccd86d5ab9a10707b113 Mon Sep 17 00:00:00 2001 From: Jasmine Hassan Date: Sat, 27 Oct 2012 11:30:45 +0200 Subject: [pathbar] make sure |path| is always valid and memory released http://git.gnome.org/browse/nautilus/commit/?id=a43bc7def3976947b9624113d18167211e76f9b8 --- src/caja-places-sidebar.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/caja-places-sidebar.c') diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c index 71d0bd59..78837dd3 100644 --- a/src/caja-places-sidebar.c +++ b/src/caja-places-sidebar.c @@ -823,6 +823,11 @@ over_eject_button (CajaPlacesSidebar *sidebar, } out: + if (*path != NULL) { + gtk_tree_path_free (*path); + *path = NULL; + } + return FALSE; } @@ -833,12 +838,11 @@ clicked_eject_button (CajaPlacesSidebar *sidebar, GdkEvent *event = gtk_get_current_event (); GdkEventButton *button_event = (GdkEventButton *) event; - *path = NULL; - if ((event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE) && over_eject_button (sidebar, button_event->x, button_event->y, path)) { return TRUE; } + return FALSE; } @@ -2609,6 +2613,8 @@ bookmarks_button_release_event_cb (GtkWidget *widget, GtkTreeView *tree_view; gboolean ret; + path = NULL; + if (event->type != GDK_BUTTON_RELEASE) { return TRUE; @@ -2703,17 +2709,15 @@ bookmarks_motion_event_cb (GtkWidget *widget, GtkTreeModel *model; model = GTK_TREE_MODEL (sidebar->filter_model); + path = NULL; if (over_eject_button (sidebar, event->x, event->y, &path)) { update_eject_buttons (sidebar, path); + gtk_tree_path_free (path); } else { update_eject_buttons (sidebar, NULL); } - if (path) { - gtk_tree_path_free (path); - } - return TRUE; } -- cgit v1.2.1