assign something to "prev" so that removing tag info succeeds. Part of

2002-04-30  Havoc Pennington  <hp@redhat.com>

	* gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): assign
	something to "prev" so that removing tag info succeeds.
	Part of #77301

	* gtk/gtktextbtree.c (_gtk_text_btree_unref): reorder so that it
	unrefs the tag table first, so that the btree is in a consistent
	state when we're removing tags from it.

	* gtk/gtktexttagtable.c (_gtk_text_tag_table_remove_buffer): strip
	all tags in the tag table out of the buffer. #77301
This commit is contained in:
Havoc Pennington 2002-04-30 15:52:52 +00:00 committed by Havoc Pennington
parent 7df4f0fb5e
commit 271018df40
8 changed files with 119 additions and 11 deletions

View File

@ -1,3 +1,16 @@
2002-04-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): assign
something to "prev" so that removing tag info succeeds.
Part of #77301
* gtk/gtktextbtree.c (_gtk_text_btree_unref): reorder so that it
unrefs the tag table first, so that the btree is in a consistent
state when we're removing tags from it.
* gtk/gtktexttagtable.c (_gtk_text_tag_table_remove_buffer): strip
all tags in the tag table out of the buffer. #77301
Tue Apr 30 11:37:09 2002 Owen Taylor <otaylor@redhat.com>
* modules/input/gtkimcontextxim.c: Make multihead-safe;

View File

@ -1,3 +1,16 @@
2002-04-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): assign
something to "prev" so that removing tag info succeeds.
Part of #77301
* gtk/gtktextbtree.c (_gtk_text_btree_unref): reorder so that it
unrefs the tag table first, so that the btree is in a consistent
state when we're removing tags from it.
* gtk/gtktexttagtable.c (_gtk_text_tag_table_remove_buffer): strip
all tags in the tag table out of the buffer. #77301
Tue Apr 30 11:37:09 2002 Owen Taylor <otaylor@redhat.com>
* modules/input/gtkimcontextxim.c: Make multihead-safe;

View File

@ -1,3 +1,16 @@
2002-04-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): assign
something to "prev" so that removing tag info succeeds.
Part of #77301
* gtk/gtktextbtree.c (_gtk_text_btree_unref): reorder so that it
unrefs the tag table first, so that the btree is in a consistent
state when we're removing tags from it.
* gtk/gtktexttagtable.c (_gtk_text_tag_table_remove_buffer): strip
all tags in the tag table out of the buffer. #77301
Tue Apr 30 11:37:09 2002 Owen Taylor <otaylor@redhat.com>
* modules/input/gtkimcontextxim.c: Make multihead-safe;

View File

@ -1,3 +1,16 @@
2002-04-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): assign
something to "prev" so that removing tag info succeeds.
Part of #77301
* gtk/gtktextbtree.c (_gtk_text_btree_unref): reorder so that it
unrefs the tag table first, so that the btree is in a consistent
state when we're removing tags from it.
* gtk/gtktexttagtable.c (_gtk_text_tag_table_remove_buffer): strip
all tags in the tag table out of the buffer. #77301
Tue Apr 30 11:37:09 2002 Owen Taylor <otaylor@redhat.com>
* modules/input/gtkimcontextxim.c: Make multihead-safe;

View File

@ -1,3 +1,16 @@
2002-04-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): assign
something to "prev" so that removing tag info succeeds.
Part of #77301
* gtk/gtktextbtree.c (_gtk_text_btree_unref): reorder so that it
unrefs the tag table first, so that the btree is in a consistent
state when we're removing tags from it.
* gtk/gtktexttagtable.c (_gtk_text_tag_table_remove_buffer): strip
all tags in the tag table out of the buffer. #77301
Tue Apr 30 11:37:09 2002 Owen Taylor <otaylor@redhat.com>
* modules/input/gtkimcontextxim.c: Make multihead-safe;

View File

@ -1,3 +1,16 @@
2002-04-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): assign
something to "prev" so that removing tag info succeeds.
Part of #77301
* gtk/gtktextbtree.c (_gtk_text_btree_unref): reorder so that it
unrefs the tag table first, so that the btree is in a consistent
state when we're removing tags from it.
* gtk/gtktexttagtable.c (_gtk_text_tag_table_remove_buffer): strip
all tags in the tag table out of the buffer. #77301
Tue Apr 30 11:37:09 2002 Owen Taylor <otaylor@redhat.com>
* modules/input/gtkimcontextxim.c: Make multihead-safe;

View File

@ -498,19 +498,24 @@ _gtk_text_btree_unref (GtkTextBTree *tree)
tree->refcount -= 1;
if (tree->refcount == 0)
{
gtk_text_btree_node_destroy (tree, tree->root_node);
g_assert (g_hash_table_size (tree->mark_table) == 0);
g_hash_table_destroy (tree->mark_table);
g_object_unref (G_OBJECT (tree->insert_mark));
g_object_unref (G_OBJECT (tree->selection_bound_mark));
{
g_signal_handler_disconnect (G_OBJECT (tree->table),
tree->tag_changed_handler);
g_object_unref (G_OBJECT (tree->table));
tree->table = NULL;
gtk_text_btree_node_destroy (tree, tree->root_node);
tree->root_node = NULL;
g_assert (g_hash_table_size (tree->mark_table) == 0);
g_hash_table_destroy (tree->mark_table);
tree->mark_table = NULL;
g_object_unref (G_OBJECT (tree->insert_mark));
tree->insert_mark = NULL;
g_object_unref (G_OBJECT (tree->selection_bound_mark));
tree->selection_bound_mark = NULL;
g_free (tree);
}
@ -1678,7 +1683,7 @@ _gtk_text_btree_tag (const GtkTextIter *start_orig,
g_assert (seg != NULL);
g_assert (indexable_seg != NULL);
g_assert (seg != indexable_seg);
if ( (seg->type == &gtk_text_toggle_on_type ||
seg->type == &gtk_text_toggle_off_type) &&
(seg->body.toggle.info == info) )
@ -5773,6 +5778,12 @@ gtk_text_btree_get_tag_info (GtkTextBTree *tree,
info->toggle_count = 0;
tree->tag_infos = g_slist_prepend (tree->tag_infos, info);
#if 0
g_print ("Created tag info %p for tag %s(%p)\n",
info, info->tag->name ? info->tag->name : "anon",
info->tag);
#endif
}
return info;
@ -5793,6 +5804,12 @@ gtk_text_btree_remove_tag_info (GtkTextBTree *tree,
info = list->data;
if (info->tag == tag)
{
#if 0
g_print ("Removing tag info %p for tag %s(%p)\n",
info, info->tag->name ? info->tag->name : "anon",
info->tag);
#endif
if (prev != NULL)
{
prev->next = list->next;
@ -5810,6 +5827,7 @@ gtk_text_btree_remove_tag_info (GtkTextBTree *tree,
return;
}
prev = list;
list = g_slist_next (list);
}
}

View File

@ -160,7 +160,7 @@ gtk_text_tag_table_finalize (GObject *object)
GtkTextTagTable *table;
table = GTK_TEXT_TAG_TABLE (object);
gtk_text_tag_table_foreach (table, foreach_unref, NULL);
g_hash_table_destroy (table->hash);
@ -406,11 +406,23 @@ _gtk_text_tag_table_add_buffer (GtkTextTagTable *table,
table->buffers = g_slist_prepend (table->buffers, buffer);
}
static void
foreach_remove_tag (GtkTextTag *tag, gpointer data)
{
GtkTextBuffer *buffer;
buffer = GTK_TEXT_BUFFER (data);
_gtk_text_buffer_notify_will_remove_tag (buffer, tag);
}
void
_gtk_text_tag_table_remove_buffer (GtkTextTagTable *table,
gpointer buffer)
{
g_return_if_fail (GTK_IS_TEXT_TAG_TABLE (table));
gtk_text_tag_table_foreach (table, foreach_remove_tag, buffer);
table->buffers = g_slist_remove (table->buffers, buffer);
}