[glade3] * plugins/gtk+/glade-gtk.c: Fixed crashes when textview's buffer is deleted, fix by Martin Schle
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3] * plugins/gtk+/glade-gtk.c: Fixed crashes when textview's buffer is deleted, fix by Martin Schle
- Date: Fri, 17 Dec 2010 09:23:24 +0000 (UTC)
commit 4e102e72826fff615a0fdd4c4e896fdbf3cdcecb
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Fri Dec 17 18:28:53 2010 +0900
* plugins/gtk+/glade-gtk.c: Fixed crashes when textview's buffer is deleted, fix
by Martin Schlemmer, bug 609748.
ChangeLog | 3 +++
plugins/gtk+/glade-gtk.c | 23 ++++++++++++++++++++---
2 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ff4096b..4051900 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,9 @@
- Defensively avoid crash when setting entry icon tooltips
- Add version check macro to compile with GTK+ 2.20
+ * plugins/gtk+/glade-gtk.c: Fixed crashes when textview's buffer is deleted, fix
+ by Martin Schlemmer, bug 609748.
+
2010-12-16 Tristan Van Berkom <tristanvb openismus com>
* plugins/gtk+/glade-gtk.c: Avoid using gtk_combo_box_set_entry_text_column directly (build
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 44411ec..32bca8e 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -8723,7 +8723,8 @@ glade_gtk_text_view_changed (GtkTextBuffer *buffer, GladeWidget *gtext)
GladeProperty *prop;
gchar *text = NULL;
- g_object_get (buffer, "text", &text, NULL);
+ if (buffer)
+ g_object_get (buffer, "text", &text, NULL);
project = glade_widget_get_project (gtext);
@@ -8784,6 +8785,21 @@ glade_gtk_text_view_post_create (GladeWidgetAdaptor *adaptor,
}
static void
+glade_gtk_text_view_set_buffer (GObject *object, const GValue *value)
+{
+ GtkTextBuffer *buffy;
+ GladeWidget *gtext;
+
+ gtext = glade_widget_get_from_gobject (object);
+
+ if ((buffy = g_value_get_object (value)) == NULL) return;
+
+ g_signal_handlers_block_by_func (buffy, glade_gtk_text_view_changed, gtext);
+ gtk_text_view_set_buffer (GTK_TEXT_VIEW (object), buffy);
+ g_signal_handlers_unblock_by_func (buffy, glade_gtk_text_view_changed, gtext);
+}
+
+static void
glade_gtk_text_view_set_text (GObject *object, const GValue *value)
{
GtkTextBuffer *buffy;
@@ -8791,15 +8807,14 @@ glade_gtk_text_view_set_text (GObject *object, const GValue *value)
const gchar *text;
GladeProject *project;
- g_return_if_fail (GTK_IS_TEXT_VIEW (object));
gtext = glade_widget_get_from_gobject (object);
- g_return_if_fail (GLADE_IS_WIDGET (gtext));
project = glade_widget_get_project (gtext);
if (glade_project_get_format (project) != GLADE_PROJECT_FORMAT_LIBGLADE)
return;
buffy = gtk_text_view_get_buffer (GTK_TEXT_VIEW (object));
+ if (buffy == NULL) return;
if ((text = g_value_get_string (value)) == NULL) return;
@@ -8816,6 +8831,8 @@ glade_gtk_text_view_set_property (GladeWidgetAdaptor *adaptor,
{
if (!strcmp (id, "text"))
glade_gtk_text_view_set_text (object, value);
+ else if (!strcmp (id, "buffer"))
+ glade_gtk_text_view_set_buffer (object, value);
else
GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor,
object,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]