GNOME Bugzilla – Bug 742015
Code snippets plugin crashes gedit when autocompleting html's "doctype" snippet
Last modified: 2019-03-23 20:54:15 UTC
$ touch foo.html $ gedit foo.html Type "doctype", press the Tab key... and you get: (gedit:2328): Gtk-CRITICAL **: gtk_text_view_get_iter_location: assertion 'gtk_text_iter_get_buffer (iter) == get_buffer (text_view)' failed Program received signal SIGSEGV, Segmentation fault. 0x00007ffff6cfd760 in _gtk_text_btree_get_chars_changed_stamp () from /lib64/libgtk-3.so.0 (gdb) bt full
+ Trace 234458
Thanks for the bug report and the backtrace. When trying to reproduce the bug, I got this instead: Traceback (most recent call last):
+ Trace 234463
proposals = self.get_proposals(self.get_word(context))
if it.starts_word() or it.starts_line() or not it.ends_word():
I'll try to fix this soon.
Created attachment 293592 [details] [review] Fix AttributeError
Review of attachment 293592 [details] [review]: I don't know the syntax in Python, but you should get the boolean return value too.
The bug seems to be 100% reproducible with gedit/gtksourceview 3.14. It's maybe already fixed in 3.15, but the snippets plugin needs to be updated first. Here is a more detailed backtrace (with 3.14) with a breakpoint at the critical message: (gedit:14758): Gtk-CRITICAL **: gtk_text_view_get_iter_location: assertion 'gtk_text_iter_get_buffer (iter) == get_buffer (text_view)' failed (gdb) bt
+ Trace 234491
The snippets plugin is adapted: https://git.gnome.org/browse/gedit/commit/?id=5540838a7dff1d025b995c251f51c1c29ce0c0ce But it isn't completely fixed.
With these two branches: https://git.gnome.org/browse/gedit/log/?h=wip/snippets-debug-messages https://git.gnome.org/browse/gtksourceview/log/?h=wip/completion-debug-messages (on git master, not 3.14) Here is the output: do_get_start_iter() assign iter iter offset in snippets: 0 (gedit:13348): 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 ----- So iter.get_offset() works fine in the snippets plugin (in Python), but calling the same function in gtksourcecompletion (with the same iter) gives the warning message. So I suspect a bug in pygobject or a missing introspection annotation (but where?).
Fixed, it was an annotation issue: https://git.gnome.org/browse/gtksourceview/commit/?id=c6992936323b2f57637ecd18898de84bce164e56 https://git.gnome.org/browse/gedit/commit/?id=d48cd10bf0bb99ead7b1af1ead52f1e554ad239d The commits are backported to the gnome-3-14 branches. Thanks for the bug report!