diff options
author | Carlos Soriano <csoriano@gnome.org> | 2015-09-24 15:54:15 +0200 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2015-09-25 16:10:32 +0200 |
commit | ecc698a282ac69e747026f58ac43eee7958be626 (patch) | |
tree | 0f17b18868189bb96219eb61aa7694d8459e1a0b /gtk | |
parent | 8eea531f25c2ae9fd5b3f865d860c517f2f0fa0f (diff) | |
download | gtk+-ecc698a282ac69e747026f58ac43eee7958be626.tar.gz |
gtkplacessidebar: avoid to use a freed string
The string we were using is the representation of the internal text
in the popover entry. However that can be freed before setting the
bookmark label, if i.e. the row is destroyed and therefore the popover
as well.
To avoid that, duplicate the label in a local variable.
One of the consequences is that for those people using development version
we migth screwed its bookmarks file, since the bookmark manager wrote
garbage from the already freed label.
https://bugzilla.gnome.org/show_bug.cgi?id=755215
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkplacessidebar.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c index 1ed8abe694..2ee7e9e86d 100644 --- a/gtk/gtkplacessidebar.c +++ b/gtk/gtkplacessidebar.c @@ -2397,10 +2397,10 @@ static void do_rename (GtkButton *button, GtkPlacesSidebar *sidebar) { - const gchar *new_text; + gchar *new_text; GFile *file; - new_text = gtk_entry_get_text (GTK_ENTRY (sidebar->rename_entry)); + new_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (sidebar->rename_entry))); file = g_file_new_for_uri (sidebar->rename_uri); if (!_gtk_bookmarks_manager_has_bookmark (sidebar->bookmarks_manager, file)) @@ -2409,6 +2409,7 @@ do_rename (GtkButton *button, _gtk_bookmarks_manager_set_bookmark_label (sidebar->bookmarks_manager, file, new_text, NULL); g_object_unref (file); + g_free (new_text); g_clear_pointer (&sidebar->rename_uri, g_free); |