RE: Subclassing TextBuffer



>Daniel Gaston wrote:
> print "Deleting Text!\n";
> self -> signal_chain_from_overridden($start_iter, $end_iter);

^^
>I think you mean
>
> $self -> signal_chain_from_overridden($start_iter, $end_iter);
>
>That would cause this:

Oops, that looks like that was it, not sure how I managed to miss that. Sometimes the easiest problems to fix are the hardest to spot :)


> $buffer -> insert_with_tags_by_name($buffer -> get_end_iter,
> "$residue",
> "$color")
>
> When I try and do that I get the following warnings:
>
> Gtk-WARNING **: Invalid text buffer iterator: either the iterator is
> uninitialized, or the characters/pixbufs/widgets in the buffer have been
> modified since the iterator was created.
> You must use marks, character numbers, or line numbers to preserve a
> position across buffer modifications.
> You can apply tags and insert marks without invalidating your iterators,
> but any mutation that affects 'indexable' buffer contents (contents that can
> be referred to by character offset)
> will invalidate all outstanding iterators at editor.pl line 295.
> Gtk-CRITICAL **: gtk_text_buffer_apply_tag: assertion
> `gtk_text_iter_get_buffer (end) == buffer' failed at editor.pl line 295.
> Inserting Text!
> Gtk2::TextIter=SCALAR(0xa66a158)
>
> After it has gone through this for everything it needs to enter (each string
> in an array) it loads the contents but without the colour tags.

>Since the assertions failed, the relevant functions bailed out, so it's not
>surprising that the rest works and you just don't have your color tags.
>
>My guess is that the problem comes from not using the iterator passed to your
>insert-text override; that's the only thing that looks out of the ordinary in
>the code you posted. Why are you forcing it to get_end_iter(), anyway?

So initially I was forcing the get_end_iter() because the tutorials I was working from did it that way. So the thing is, because of
the nature of the program I am writing, the text actually needs to be inserted character by character and is done in the middle of a
looping function. I freely admit that I am still learning the ins and outs of programming in Gtk2 Perl.

Dan


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