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 730410 - serviceproxy: service_proxy_add_notify shouldn't have (scope async)
serviceproxy: service_proxy_add_notify shouldn't have (scope async)
Status: RESOLVED DUPLICATE of bug 701446
Product: GUPnP
Classification: Other
Component: gupnp
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GUPnP Maintainers
GUPnP Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-05-20 00:16 UTC by Brendan Long
Modified: 2014-05-20 06:38 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Brendan Long 2014-05-20 00:16:37 UTC
I've been having some trouble in Vala, where calling service_proxy.add_notify(..) was causing my object to be unreffed every time it got called.

My Vala code looks like this:

        // ...
        service.add_notify("UIListingUpdate", typeof(string),
            handle_ui_listing_update);
        // ...

    void handle_ui_listing_update(GUPnP.ServiceProxy service) {
        service.begin_action("GetCompatibleUIs", handle_compatible_uis,
            /* in */
            "InputDeviceProfile", typeof(string), "",
            "UIFilter", typeof(string), "",
            null);
    }

And this is the C code it generated for the callback:

        // ...
	gupnp_service_proxy_add_notify (_tmp1_, "UIListingUpdate", G_TYPE_STRING, _rui_discoverer_handle_ui_listing_update_gu_pn_pservice_proxy_notify_callback, rui_discoverer_ref (self));
        // ...

static void _rui_discoverer_handle_ui_listing_update_gu_pn_pservice_proxy_notify_callback (GUPnPServiceProxy* proxy, const gchar* variable, GValue* value, gpointer self) {
	rui_discoverer_handle_ui_listing_update (self, proxy);
	rui_discoverer_unref (self);
}

It looks like scope = async makes it assume that the function is only called once, and the input data should be unrefed after that. Removing (scope async) from add_notify in gupnp-1.0.vapi fixed this.

I tried removing it from the annotation in gupnp_service_proxy.c, but then I get:

Warning: GUPnP: gupnp_service_proxy_add_notify: argument callback: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)

So presumably the real fix is more complicated than this.
Comment 1 Jens Georg 2014-05-20 06:38:11 UTC
Yeah, that's already known and more or less fixed, needs to be pushed (I forgot, sorry)

*** This bug has been marked as a duplicate of bug 701446 ***