[gtk+] places sidebar: Fix memory handling of rename popover



commit 8b90c79037be95cb9a5c93c8e5145e9da0cd316e
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jul 4 22:32:06 2015 -0400

    places sidebar: Fix memory handling of rename popover
    
    We were freeing the same string twice here, leading to
    badness.

 gtk/gtkplacessidebar.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index f833ea9..5f92fac 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -2435,7 +2435,7 @@ show_rename_popover (GtkSidebarRow *row)
 
   if (sidebar->rename_uri)
     g_free (sidebar->rename_uri);
-  sidebar->rename_uri = uri;
+  sidebar->rename_uri = g_strdup (uri);
 
   gtk_entry_set_text (GTK_ENTRY (sidebar->rename_entry), name);
   gtk_popover_set_relative_to (GTK_POPOVER (sidebar->rename_popover), GTK_WIDGET (row));
@@ -3942,6 +3942,15 @@ gtk_places_sidebar_dispose (GObject *object)
       sidebar->popup_menu = NULL;
     }
 
+  if (sidebar->rename_popover)
+    {
+      gtk_widget_destroy (sidebar->rename_popover);
+      sidebar->rename_popover = NULL;
+      sidebar->rename_entry = NULL;
+      sidebar->rename_button = NULL;
+      sidebar->rename_error = NULL;
+    }
+
   if (sidebar->trash_monitor)
     {
       g_signal_handler_disconnect (sidebar->trash_monitor, sidebar->trash_monitor_changed_id);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]