After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 656854 - crash when Snippets tried to create a details view.
crash when Snippets tried to create a details view.
Status: RESOLVED FIXED
Product: gedit-plugins
Classification: Other
Component: General
3.0.x
Other Linux
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2011-08-18 21:23 UTC by Curtis Hovey
Modified: 2019-03-23 20:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Update the info window to the current gtk3 api (1.59 KB, patch)
2011-09-07 22:10 UTC, Curtis Hovey
reviewed Details | Review
Second patch to address reviewer comments (1.96 KB, patch)
2011-09-07 23:02 UTC, Curtis Hovey
needs-work Details | Review
Combined patch of snippet changes. (3.56 KB, patch)
2011-09-08 14:13 UTC, Curtis Hovey
none Details | Review

Description Curtis Hovey 2011-08-18 21:23:39 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):
  • File "/usr/lib/gedit/plugins/snippets/completion.py", line 126 in do_get_info_widget
    view = Gedit.View(Gedit.Document())
TypeError: GObject.__init__() takes exactly 0 arguments (1 given)

^ 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
Comment 1 Curtis Hovey 2011-09-07 22:10:13 UTC
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.
Comment 2 Ignacio Casal Quinteiro (nacho) 2011-09-07 22:15:41 UTC
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.
Comment 3 Curtis Hovey 2011-09-07 23:02:36 UTC
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.
Comment 4 Ignacio Casal Quinteiro (nacho) 2011-09-08 09:20:49 UTC
Review of attachment 195939 [details] [review]:

Looks good.
Comment 5 Ignacio Casal Quinteiro (nacho) 2011-09-08 09:24:01 UTC
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?
Comment 6 Ignacio Casal Quinteiro (nacho) 2011-09-08 14:09:40 UTC
Pushed a slightly modified version of your patch. Thanks a lot.

http://git.gnome.org/browse/gedit/commit/?id=2273ba27e85588c10788039b66b083aba6b50660
Comment 7 Curtis Hovey 2011-09-08 14:13:21 UTC
Created attachment 195991 [details] [review]
Combined patch of snippet changes.

My second patch was an incremental. I attached a patch combining both my commits.
Comment 8 Ignacio Casal Quinteiro (nacho) 2011-09-08 14:15:25 UTC
I just pushed one, the Gedit.Document is needed to have the same scheme color.
Comment 9 Curtis Hovey 2011-09-08 14:57:26 UTC
Thank you for your help.