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 610342 - Virtual functions in completion proposal and provider should return allocated string.
Virtual functions in completion proposal and provider should return allocated...
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
2.9.x
Other Linux
: Normal normal
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2010-02-18 09:17 UTC by Krzesimir Nowak
Modified: 2010-02-21 22:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fixes provider. (5.27 KB, patch)
2010-02-21 19:16 UTC, Krzesimir Nowak
none Details | Review
Fixes proposal. (12.01 KB, patch)
2010-02-21 19:16 UTC, Krzesimir Nowak
none Details | Review
Fixes a warning in test-completion. (1.21 KB, patch)
2010-02-21 19:17 UTC, Krzesimir Nowak
none Details | Review

Description Krzesimir Nowak 2010-02-18 09:17:45 UTC
Currently vfuncs listed below returns a pointer to internal string, which poses a problem for bindings wrapping them [1]:

In GtkSourceCompletionProposal:
- get_label()
- get_markup()
- get_text()
- get_info()

In GtkSourceCompletionProvider:
- get_name()

Solution could be turning those strings into properties or return a g_strdup() of them.

[1] Details about this is on opened-hand bugzilla - such situation happened already in Clutter:
http://bugzilla.o-hand.com/show_bug.cgi?id=1403
Comment 1 Paolo Borelli 2010-02-21 16:09:45 UTC
well, for the Proposal is a bit unfortunate since it is just meant as a container object for those information.

That said, strdup should not be too bad either... would you be able to provide a patch?
Comment 2 Krzesimir Nowak 2010-02-21 19:15:17 UTC
(In reply to comment #1)
> That said, strdup should not be too bad either... would you be able to provide
> a patch?

Sure. I decided to split those patches into 3 parts. First fixes provider, second completion and third is a small patch fixing resulting warning in test-completion.
Comment 3 Krzesimir Nowak 2010-02-21 19:16:17 UTC
Created attachment 154336 [details] [review]
Fixes provider.
Comment 4 Krzesimir Nowak 2010-02-21 19:16:51 UTC
Created attachment 154337 [details] [review]
Fixes proposal.
Comment 5 Krzesimir Nowak 2010-02-21 19:17:30 UTC
Created attachment 154338 [details] [review]
Fixes a warning in test-completion.
Comment 6 Paolo Borelli 2010-02-21 20:35:42 UTC
All three patches look good, thanks a lot. Please push.

We'll also need to fix pygtksourceview and gedit and notify anjuta guys.
Comment 7 Krzesimir Nowak 2010-02-21 21:40:18 UTC
Pushed.

I already had a look at gedit and anjuta (but not pygtksourceview) by grepping sources with command:

grep -nrHEe "GtkSourceCompletionProposal|GtkSourceCompletionProvider|GtkSourceCompletionWords|GTK_TYPE_SOURCE_COMPLETION_PROPOSAL|GTK_TYPE_SOURCE_COMPLETION_PROVIDER|GTK_TYPE_SOURCE_COMPLETION_WORDS|gtk_source_completion_proposal|gtk_source_completion_provider|gtk_source_completion_words" --exclude-dir=.git .

gedit - found nothing.

gedit-plugins - found something, but after examination I noticed it does neither use nor override any of affected functions.

anjuta - sourceview plugin implements provider, so its get_name implementation should be changed. Its provider also implements IAnjutaProvider interface, which also defines a get_name() function returning const gchar* instead of gchar*. In the end affected plugins are sourceview, language-support-cpp-java and language-support-js. I even could provide a patch.

pygtksourceview - I have no clue how are python bindings are generated, but probably it should have .defs file regenerated and that is all (assuming that functions returning a gchar* are automatically marked at those, whose result should be freed - if not, probably an override should be written.)
Comment 8 jessevdk@gmail.com 2010-02-21 21:48:35 UTC
For pygsv, I would not be surprised if the current bindings actually leak those strings (as that is the whole problem as far as I understand). And yes, changing the defs should be enough I think. With regard to the use of completion, there is at least snippets that uses it, but that's a python plugin, so no changes needed there.
Comment 9 Ignacio Casal Quinteiro (nacho) 2010-02-21 21:52:19 UTC
If you feel like providing a patch for anjuta, I would review it.
Comment 10 Krzesimir Nowak 2010-02-21 22:03:19 UTC
I'll post patches in respective bugs I filed:

pygsv - bug 610635
anjuta - bug 610636