[gnome-photos] searchbar: Copy the widget's internal string
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] searchbar: Copy the widget's internal string
- Date: Thu, 6 Feb 2014 15:56:53 +0000 (UTC)
commit f356ed6b3c3b1f7b7a2e6d70e3d20a42a9e95c31
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Feb 6 16:07:54 2014 +0100
searchbar: Copy the widget's internal string
... so that it does not change underneath us.
src/photos-searchbar.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/photos-searchbar.c b/src/photos-searchbar.c
index 5356dfc..3ed607e 100644
--- a/src/photos-searchbar.c
+++ b/src/photos-searchbar.c
@@ -269,8 +269,8 @@ photos_searchbar_handle_event (PhotosSearchbar *self, GdkEventKey *event)
PhotosSearchbarPrivate *priv = self->priv;
gboolean res;
gboolean ret_val = GDK_EVENT_PROPAGATE;
- const gchar *new_text;
- const gchar *old_text;
+ gchar *new_text = NULL;
+ gchar *old_text = NULL;
if (priv->in)
goto out;
@@ -293,9 +293,9 @@ photos_searchbar_handle_event (PhotosSearchbar *self, GdkEventKey *event)
G_CALLBACK (photos_searchbar_preedit_changed),
self);
- old_text = gtk_entry_get_text (GTK_ENTRY (priv->search_entry));
+ old_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->search_entry)));
res = gtk_widget_event (priv->search_entry, (GdkEvent *) event);
- new_text = gtk_entry_get_text (GTK_ENTRY (priv->search_entry));
+ new_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->search_entry)));
g_signal_handlers_disconnect_by_func (priv->search_entry, photos_searchbar_preedit_changed, self);
@@ -308,6 +308,8 @@ photos_searchbar_handle_event (PhotosSearchbar *self, GdkEventKey *event)
}
out:
+ g_free (new_text);
+ g_free (old_text);
return ret_val;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]