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 674410 - Ref counting error on Device proxy (Network Manager Context)
Ref counting error on Device proxy (Network Manager Context)
Status: RESOLVED FIXED
Product: GUPnP
Classification: Other
Component: gupnp
unspecified
Other Linux
: Normal major
: ---
Assigned To: GUPnP Maintainers
GUPnP Maintainers
: 680950 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-04-19 16:30 UTC by Ludovic Ferrandis
Modified: 2012-08-19 15:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Remove refcounting increment on device proxy when using it. (888 bytes, patch)
2012-04-19 16:30 UTC, Ludovic Ferrandis
committed Details | Review

Description Ludovic Ferrandis 2012-04-19 16:30:30 UTC
Created attachment 212369 [details] [review]
Remove refcounting increment on device proxy when using it.

In function nm_device_new, device_proxy refcount was incremented.
device_proxy is created in function device_proxy_new_cb() by g_dbus_proxy_new_for_bus_finish call. After this call, refcount = 1.

When in device_proxy_new_cb(), nm_device_new() is called, device_proxy refcount=2.

So when nm_device_free() is called, device_proxy refcount=1 and such is not deleted.

The bug is not critical and doesn't make gupnp crash because device_proxy is not set to NULL after calling g_object_unref in nm_device_free.

The side effect is that as the context is not destroyed, the signal handler on this proxy still exist.
The signal has been set in use_new_device() function. 
g_signal_connect (nm_device->proxy,
                  "g-signal",
                  G_CALLBACK (on_device_signal),
                  nm_device);

If nm_device->proxy was set to NULL in nm_device_free(), a crash will/could occurs.

The side effect is that the callback is called for a device proxy that should be destroyed.
Comment 1 Jens Georg 2012-04-20 11:36:46 UTC
Review of attachment 212369 [details] [review]:

Looks correct to me. nm_device takes ownership of the proxy
Comment 2 Jens Georg 2012-08-19 15:09:12 UTC
*** Bug 680950 has been marked as a duplicate of this bug. ***