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 650607 - GIR output for interfaces may be off (missing <field>'s)
GIR output for interfaces may be off (missing <field>'s)
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: GObject Introspection
0.12.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2011-05-19 16:25 UTC by august
Modified: 2011-05-23 16:46 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description august 2011-05-19 16:25:21 UTC
I've been playing around with vala, libpeas, and plugins loaded on the fly through libseed (javascript) and python.                                                                               
The way you make plugins in libpeas  is through extensions.  These can be defined through an interface.  It looks something like this:                                                            
public interface MyActivatable : Object { 
public abstract ScriptableWindow window { get; set; } 
public abstract void activate (); 
public abstract void deactivate();} 

Since libpeas doesn't really handle Vala code, I've been trying to write vala that compiles close to the same C code that libpease wants. 

The above interface works to some extent, but I did noticed that the  GIR file that  vala produces is not the same as what libpeas has.  They have a default interface called "Activatable"  whos GIR file looks like so (section):

<fieldname="activate">
<callback name="activate">
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
<parameters>
<parameter name="activatable" transfer-ownership="none">
<type name="Activatable" c:type="PeasActivatable*"/>
</parameter>
</parameters>
</callback></field>                                                                        

The GIr that vala produces looks like this however:

<callback name="my_activatable_activate" c:type="my_activatable_activate">
<return-value transfer-ownership="none">
<type name="none"/>
</return-value>
</callback>

It is missing the <field> tags altogether.  Since they are using some sort of automatic means of generating the GIR file, I wonder where these <field> statems come from.  I was told on the #libpeas IRC that the GIR creation is off in vala. 

There is something wrong in the GIR that causes all python plugins to crash when they use MyActivatable instead of the default Activatable from libpeas.
Comment 1 august 2011-05-19 19:28:25 UTC
with vala 12  (from the tarball), the <field> tags are generated, but not the <parameters> tags
Comment 2 Luca Bruno 2011-05-23 16:46:51 UTC
commit ec7f7b1f15f08c49d70200a1b9226be6e0231abf
Author: Luca Bruno <lucabru@src.gnome.org>
Date:   Mon May 23 18:43:49 2011 +0200

    girwriter: Add self parameter to the callback of virtual methods field
    
    Fixes bug 650607.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.