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 549061 - Can't use GConf.Client.all_entries due to gconf_entry_ref not returning the pointer to an Entry
Can't use GConf.Client.all_entries due to gconf_entry_ref not returning the p...
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings
0.3.x
Other All
: Normal normal
: ---
Assigned To: Jürg Billeter
Vala maintainers
Depends on: 566078
Blocks:
 
 
Reported: 2008-08-22 21:52 UTC by Tobias Mueller
Modified: 2009-01-16 16:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Checks for void ref functions while running vapigen, patches the CodeWriter too (3.80 KB, patch)
2009-01-10 10:55 UTC, Andreas Brauchli
committed Details | Review

Description Tobias Mueller 2008-08-22 21:52:59 UTC
I have the following code which I expected to compile fine:


using GConf;

int main ()
{
    GConf.Client gc = GConf.Client.get_default();
    string root = "/apps/myapp";
    weak GLib.SList<GConf.Entry> entrylist = gc.all_entries(root);
    foreach (GConf.Entry entry in entrylist) {
        stdout.printf("Key: %s Value: %s\n",
            entry.key,
            entry.get_value().get_bool()?"True":"False"
        );
    }
    return 0;
}


But it fails with the following message:
$ jhbuild run valac --pkg gconf-2.0 --pkg glib-2.0 vala-gconf-lists.vala
vala-gconf-lists.vala:7.46-7.65: warning: unhandled error `GLib.Error'
    weak GLib.SList<GConf.Entry> entrylist = gc.all_entries(root);
                                             ^^^^^^^^^^^^^^^^^^^^
vala-gconf-lists.c: In function ‘_main’:
vala-gconf-lists.c:40: error: void value not ignored as it ought to be
error: cc exited with status 256
Compilation failed: 1 error(s), 1 warning(s)

The corresponding line in the C Code is:
			entry = (_tmp1 = ((GConfEntry*) (entry_it->data)), (_tmp1 == NULL ? NULL : gconf_entry_ref (_tmp1)));


The gconf_entry_ref (_tmp1) seems to be a problem. So if I do a
    foreach (weak GConf.Entry entry in entrylist) {
it compiles fine.
Comment 1 Tobias Mueller 2008-08-22 21:58:20 UTC
Maybe this bug depends on bug 549063
Comment 2 Tobias Mueller 2008-08-22 22:07:42 UTC
With the patch from attachment #117245 [details] applied to GConf, I can build the first testcase.
Comment 3 Jürg Billeter 2009-01-09 23:14:31 UTC
Vala now supports [CCode (ref_function_void = true)], so this can be fixed in the bindings.
Comment 4 Andreas Brauchli 2009-01-10 10:55:31 UTC
Created attachment 126161 [details] [review]
Checks for void ref functions while running vapigen, patches the CodeWriter too

untested
Comment 5 Jürg Billeter 2009-01-16 16:04:57 UTC
2009-01-16  Jürg Billeter  <j@bitron.ch>

	* vala/valacodewriter.vala:

	Support void ref functions

	* vapigen/valagidlparser.vala:

	Detect void ref functions, patch by Andreas Brauchli,
	fixes bug 549061

	* vapi/gconf-2.0.vapi: regenerated

Fixed in r2354.