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 690003 - get_text method moved
get_text method moved
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: VTE Maintainers
VTE Maintainers
Depends on: 676999
Blocks:
 
 
Reported: 2012-12-10 19:52 UTC by Behdad Esfahbod
Modified: 2012-12-10 23:09 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Behdad Esfahbod 2012-12-10 19:52:27 UTC
+++ This bug was initially created as a clone of Bug #676999 +++

 Gonzalo Odiard 2012-12-10 19:44:09 UTC

I have found two issues trying to use the get_text method in vte with python
after apply this patch.

The first is I can't set is_selected as None, the c code can manage it (vte.c
line 6293) but the introspection annotations don't allow this.

Can be solved doing:

- * @is_selected: (scope call): a #VteSelectionFunc callback
+ * @is_selected: (scope call) (allow-none): a #VteSelectionFunc callback

The second issue is more difficult to solve in a proper way:

The attributes parameter is marked as:

- * @attributes: (out) (transfer full) (array) (element-type
Vte.CharAttributes): location for storing text attributes

but if is a out parameter, I can't pass it as a parameter from python, and the
first line using the parameter in the c code is:

line 6298

    if (attributes)
        g_array_set_size (attributes, 0);

Then should be None or a already created GArray.

Right now the application crash when I do:

vte.get_text(None, None)

The only workaround I have found is change:

 - * @attributes: (out) (transfer full) (array) (element-type
Vte.CharAttributes): location for storing text attributes
+ * @attributes: (array) (element-type Vte.CharAttributes): location for
storing text attributes

and calling from python doing:

vte.get_text(None, None, [])

now the application don't crash, but of course the attributes array is not
loaded.

A test case is attached, and a diff to test these changes.
Comment 1 Behdad Esfahbod 2012-12-10 19:53:02 UTC
Colin, any idea re the out array issue?
Comment 2 Colin Walters 2012-12-10 21:58:49 UTC
(In reply to comment #1)
> Colin, any idea re the out array issue?

Try (out caller-allocates) instead of just (out).  The latter is used when you return a new array container, i.e. GArray **.
Comment 3 Behdad Esfahbod 2012-12-10 23:09:40 UTC
Thanks.  I assume (out caller-allocates) is consistent with (transfer full).  Pushed both out.  Closing, please reopen if issue persists.