Re: GtkTextTag

Gustavo Joćo Alves Marques Carneiro <ee96090 fe up pt> writes:
> I got this from Gtk:
> Gtk-ERROR **: file gtktexttag.c: line 1916
> (_gtk_text_attributes_fill_from_tags): assertion failed:
> (tags[n]->priority > tags[n-1]->priority)
>   It appears that GtkTextBuffer doesn't like tags that don't belong to a
> GtkTextTagTable.

Yes, that's right. The tags must be in the tag table for the buffer. 
However we could use a better error message in this case... a bugzilla
report suggesting that would be good.

>   As a workaround, I added all my tags to the text buffer's tag table. It
> worked. Unfortunately I need to add the same set of tags to a different
> buffer, but I can't.

Well, you can share the same tag table between two buffers;
gtk_text_buffer_new() accepts a tag table argument. If two buffers
have the same tags you'll also save a bit of memory this way.

If you want some of the same tags but not all, then you need to 
create two identical tags. Conceivably we should have
gtk_text_tag_copy(), but lacking that you can easily just have a
function that creates the tags, and call that function twice.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]