summaryrefslogtreecommitdiff
path: root/gtk/gtktextview.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2002-03-23 17:35:09 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-03-23 17:35:09 +0000
commite00f842a5b0fbea7ab12fe9470926b8e4d146f08 (patch)
treec2f371681ec0576509e7b10266dd47df1b71c6fb /gtk/gtktextview.c
parent8d3df4d9a1bea9b3893940fb225e815cabd42d09 (diff)
downloadgtk+-e00f842a5b0fbea7ab12fe9470926b8e4d146f08.tar.gz
disconnect layout handlers earlier in the function, to avoid possible
2002-03-23 Havoc Pennington <hp@pobox.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): disconnect layout handlers earlier in the function, to avoid possible reentrancy screwups (gtk_text_view_invalidate): Don't install idle handlers if layout == NULL, otherwise we get problems during finalization since clearing the buffer invalidates and puts the idle handlers back after we destroy the layout. #74660 (gtk_text_view_ensure_layout): Install the validation handlers right after creating the layout. * gtk/gtktexttagtable.c (foreach_unref): call _gtk_text_buffer_notify_will_remove_tag(), #75126
Diffstat (limited to 'gtk/gtktextview.c')
-rw-r--r--gtk/gtktextview.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 230cc83318..31c58109a2 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -2431,7 +2431,7 @@ gtk_text_view_finalize (GObject *object)
text_window_free (text_view->bottom_window);
g_object_unref (G_OBJECT (text_view->im_context));
-
+
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
@@ -3091,6 +3091,10 @@ gtk_text_view_invalidate (GtkTextView *text_view)
text_view->onscreen_validated));
text_view->onscreen_validated = FALSE;
+
+ /* We'll invalidate when the layout is created */
+ if (text_view->layout == NULL)
+ return;
if (!text_view->first_validate_idle)
{
@@ -5261,6 +5265,8 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
tmp_list = g_slist_next (tmp_list);
}
+
+ gtk_text_view_invalidate (text_view);
}
}
@@ -5297,6 +5303,13 @@ gtk_text_view_destroy_layout (GtkTextView *text_view)
GSList *tmp_list;
gtk_text_view_remove_validate_idles (text_view);
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (text_view->layout),
+ (gpointer) invalidated_handler,
+ text_view);
+ g_signal_handlers_disconnect_by_func (G_OBJECT (text_view->layout),
+ (gpointer) changed_handler,
+ text_view);
/* Remove layout from all anchored children */
tmp_list = text_view->children;
@@ -5316,12 +5329,6 @@ gtk_text_view_destroy_layout (GtkTextView *text_view)
gtk_text_view_stop_cursor_blink (text_view);
gtk_text_view_end_selection_drag (text_view, NULL);
- g_signal_handlers_disconnect_by_func (G_OBJECT (text_view->layout),
- (gpointer) invalidated_handler,
- text_view);
- g_signal_handlers_disconnect_by_func (G_OBJECT (text_view->layout),
- (gpointer) changed_handler,
- text_view);
g_object_unref (G_OBJECT (text_view->layout));
text_view->layout = NULL;
}