GNOME Bugzilla – Bug 656854
crash when Snippets tried to create a details view.
Last modified: 2019-03-23 20:49:13 UTC
I was using the snippet completion plugin. After using control+space to open the completion list. pressed the details button to see more about the selection. gedit went belly up: Traceback (most recent call last):
+ Trace 228137
view = Gedit.View(Gedit.Document())
^ This looks like a python gi error. Classes that descend from gobject must be initialised using keyword arguments. I expect the problem line to be written as view = Gedit.View(doc=Gedit.Document()) per http://developer.gnome.org/gedit/stable/gedit-gedit-view.html#gedit-view-new
Created attachment 195938 [details] [review] Update the info window to the current gtk3 api The attached patch fixes three issue I discovered when looking at the snippet completion provider's info window. 1. The buffer (Gedit.Document) had to be passed as a kwarg when using an implicit constructor, or use the explicit constructor. I chose the later. 2. Gtk.TextView.scroll_to_iter()'s args changed from 3 to 6. I provided generic values. 3. CompletionInfo does not have either set_sizing() or process_resize() methods. I deleted the calls since they were just calling with default values.
Review of attachment 195938 [details] [review]: Just some style inline comments. ::: plugins/snippets/snippets/completion.py @@ +124,3 @@ def do_get_info_widget(self, proposal): if not self.info_widget: + view = Gedit.View.new_with_buffer(Gedit.Document()) maybe just better Gedit.View(buffer=Gedit.Document())? @@ +144,3 @@ buf.move_mark(buf.get_insert(), buf.get_start_iter()) buf.move_mark(buf.get_selection_bound(), buf.get_start_iter()) + self.info_view.scroll_to_iter( let's put it in the same line.
Created attachment 195939 [details] [review] Second patch to address reviewer comments I unwrapped the long line. I discovered a nasty error using Gedit.View(buffer=Gedit.Document()): AttributeError: do_set_property ** ERROR:/build/buildd/pygobject-2.90.3/gi/_gobject/pygobject.c:551:pygobject_switch_to_toggle_ref: assertion failed: (self->obj->ref_count >= 1) Aborted (core dumped) However, I too prefer the kwarg. Gedit is not needed in this case. I used GtkSource.View(buffer=GtkSource.Buffer()) which does work. I removed the Gedit import since it is not used in the module.
Review of attachment 195939 [details] [review]: Looks good.
Comment on attachment 195939 [details] [review] Second patch to address reviewer comments I've just tried to apply your patch and seems wrong. You sure you are working with gedit master branch?
Pushed a slightly modified version of your patch. Thanks a lot. http://git.gnome.org/browse/gedit/commit/?id=2273ba27e85588c10788039b66b083aba6b50660
Created attachment 195991 [details] [review] Combined patch of snippet changes. My second patch was an incremental. I attached a patch combining both my commits.
I just pushed one, the Gedit.Document is needed to have the same scheme color.
Thank you for your help.