diff --git a/ChangeLog b/ChangeLog index bed5567b58..6b393f82e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2002-04-30 Havoc Pennington + + * 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 * modules/input/gtkimcontextxim.c: Make multihead-safe; diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index bed5567b58..6b393f82e6 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,16 @@ +2002-04-30 Havoc Pennington + + * 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 * modules/input/gtkimcontextxim.c: Make multihead-safe; diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index bed5567b58..6b393f82e6 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,16 @@ +2002-04-30 Havoc Pennington + + * 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 * modules/input/gtkimcontextxim.c: Make multihead-safe; diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index bed5567b58..6b393f82e6 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,16 @@ +2002-04-30 Havoc Pennington + + * 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 * modules/input/gtkimcontextxim.c: Make multihead-safe; diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index bed5567b58..6b393f82e6 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,16 @@ +2002-04-30 Havoc Pennington + + * 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 * modules/input/gtkimcontextxim.c: Make multihead-safe; diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index bed5567b58..6b393f82e6 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,16 @@ +2002-04-30 Havoc Pennington + + * 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 * modules/input/gtkimcontextxim.c: Make multihead-safe; diff --git a/gtk/gtktextbtree.c b/gtk/gtktextbtree.c index fa5aeb095f..30c66e4a70 100644 --- a/gtk/gtktextbtree.c +++ b/gtk/gtktextbtree.c @@ -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 == >k_text_toggle_on_type || seg->type == >k_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); } } diff --git a/gtk/gtktexttagtable.c b/gtk/gtktexttagtable.c index 993f5d1b34..3b1fa1997c 100644 --- a/gtk/gtktexttagtable.c +++ b/gtk/gtktexttagtable.c @@ -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); }