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
This commit is contained in:
Havoc Pennington 2002-03-23 17:35:09 +00:00 committed by Havoc Pennington
parent 8d3df4d9a1
commit e00f842a5b
8 changed files with 115 additions and 7 deletions

View File

@ -1,3 +1,18 @@
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
2002-03-22 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkfont-x11.c (gdk_fontset_load): add more explanatory

View File

@ -1,3 +1,18 @@
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
2002-03-22 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkfont-x11.c (gdk_fontset_load): add more explanatory

View File

@ -1,3 +1,18 @@
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
2002-03-22 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkfont-x11.c (gdk_fontset_load): add more explanatory

View File

@ -1,3 +1,18 @@
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
2002-03-22 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkfont-x11.c (gdk_fontset_load): add more explanatory

View File

@ -1,3 +1,18 @@
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
2002-03-22 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkfont-x11.c (gdk_fontset_load): add more explanatory

View File

@ -1,3 +1,18 @@
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
2002-03-22 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkfont-x11.c (gdk_fontset_load): add more explanatory

View File

@ -135,10 +135,21 @@ gtk_text_tag_table_new (void)
static void
foreach_unref (GtkTextTag *tag, gpointer data)
{
GSList *tmp;
/* We don't want to emit the remove signal here; so we just unparent
* and unref the tag.
*/
tmp = tag->table->buffers;
while (tmp != NULL)
{
_gtk_text_buffer_notify_will_remove_tag (GTK_TEXT_BUFFER (tmp->data),
tag);
tmp = tmp->next;
}
tag->table = NULL;
g_object_unref (G_OBJECT (tag));
}

View File

@ -3092,6 +3092,10 @@ gtk_text_view_invalidate (GtkTextView *text_view)
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)
{
text_view->first_validate_idle = g_idle_add_full (GTK_PRIORITY_RESIZE - 2, first_validate_callback, text_view, NULL);
@ -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);
}
}
@ -5298,6 +5304,13 @@ gtk_text_view_destroy_layout (GtkTextView *text_view)
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;
while (tmp_list != NULL)
@ -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;
}