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 677769 - Unable to specify different name for async _finish function: so cannot subclass GLib.Volume because of mount() member
Unable to specify different name for async _finish function: so cannot subcla...
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings: GLib
0.17.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2012-06-09 17:45 UTC by Sam Thursfield
Modified: 2016-09-18 13:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test case for #667769 (1.71 KB, text/x-vala)
2012-06-09 17:45 UTC, Sam Thursfield
  Details
gio-2.0: Force finish_vfunc_name of Volume.mount() to "mount_finish" (1.43 KB, patch)
2016-09-18 13:44 UTC, Rico Tzschichholz
committed Details | Review

Description Sam Thursfield 2012-06-09 17:45:09 UTC
Test case attached, which tries to implement a subclass of GLib.Volume.

The C compilation fails with the following:

/home/sam/build/src/vala-volume.vala.c: In function ‘test_volume_g_volume_interface_init’:
/home/sam/build/src/vala-volume.vala.c:466:18: warning: assignment from incompatible pointer type [enabled by default]
/home/sam/build/src/vala-volume.vala.c:467:7: error: ‘GVolumeIface’ has no member named ‘mount_fn_finish’
/home/sam/build/src/vala-volume.vala.c:469:15: warning: assignment from incompatible pointer type [enabled by default]
/home/sam/build/src/vala-volume.vala.c:471:30: warning: assignment from incompatible pointer type [enabled by default]
/home/sam/build/src/vala-volume.vala.c: In function ‘main’:
/home/sam/build/src/vala-volume.vala.c:510:2: warning: passing argument 1 of ‘_vala_main’ from incompatible pointer type [enabled by default]
/home/sam/build/src/vala-volume.vala.c:496:6: note: expected ‘const gchar *’ but argument is of type ‘char **’
error: cc exited with status 256
Compilation failed: 1 error(s), 7 warning(s)


This is because the mount() async function in the C vtable has C name mount_fn(), but the compile function is called mount_finish(). Vala is assuming its name to be mount_fn_finish().
Comment 1 Sam Thursfield 2012-06-09 17:45:35 UTC
Created attachment 216042 [details]
Test case for #667769
Comment 2 Sam Thursfield 2012-06-11 09:34:50 UTC
"compile function" should be "completion function" in the description above.
Comment 3 Rico Tzschichholz 2016-09-18 13:44:10 UTC
Created attachment 335802 [details] [review]
gio-2.0: Force finish_vfunc_name of Volume.mount() to "mount_finish"
Comment 4 Rico Tzschichholz 2016-09-18 13:46:37 UTC
Attachment 335802 [details] pushed as c4336c0 - gio-2.0: Force finish_vfunc_name of Volume.mount() to "mount_finish"