GNOME Bugzilla – Bug 761615
Can't override GtkTextView's insert_text vfunc
Last modified: 2018-01-10 20:52:54 UTC
Created attachment 320520 [details] Test case Any override of this vfunc results in the following warning when called: (buffertest.py:18458): 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 I haven't figured out exactly what's required to trigger this; you'll see in the attached test case that a simple insert works, but if you type anything in the text view you should see this triggered straight away. It's possible that this is a bug in GtkTextBuffer, but given that GtkSourceBuffer overrides this vfunc just fine, I'm guessing it's more likely an introspection issue.
This might be related to bug 661469, although that bug is dealing with caller allocated out arguments but it does describe problems related to TextIters. Is connecting to the "insert-text" signal a valid workaround for your use case?
Yes, the insert-text signal is what I'm currently using. I was just looking to use the vfunc to simplify some logic, so I can't call this urgent.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/pygobject/issues/110.