GNOME Bugzilla – Bug 741653
gnetworkmonitornm: Check if network-manager is running
Last modified: 2015-01-13 11:14:20 UTC
There's a crash here. g_dbus_proxy_new_for_bus_sync returns a non-NULL GDBusProxy if NM isn't running, or even if it's not installed, which we then try to operate on. (gdb) bt at /build/buildd/glib2.0-2.43.2/./gio/gnetworkmonitornm.c:260 cancellable=0x0, error=0x0) at /build/buildd/glib2.0-2.43.2/./gio/ginitable.c:228 first_property_name=first_property_name@entry=0x0) at /build/buildd/glib2.0-2.43.2/./gio/ginitable.c:146 at /build/buildd/glib2.0-2.43.2/./gio/giomodule.c:755 envvar=0x7ffff7b69578 "GIO_USE_NETWORK_MONITOR", verify_func=0x0) at /build/buildd/glib2.0-2.43.2/./gio/giomodule.c:857 at /build/buildd/glib2.0-2.43.2/./glib/gtestutils.c:2120 at /build/buildd/glib2.0-2.43.2/./glib/gtestutils.c:2131
Created attachment 292900 [details] [review] gnetworkmonitornm: Check if network-manager is running We were asking for properties on NM's dbus interface, but if NM is not running then there won't be any, so we were crashing. Check if the name has an owner before doing anything to it. Also check for NULL when retrieving cached property names, in case there aren't any.
Review of attachment 292900 [details] [review]: Please retest with a version that includes 327d35ed414b845e0199a11e8bcbb5296ad70c95. ::: gio/gnetworkmonitornm.c @@ +221,3 @@ props = g_dbus_proxy_get_cached_property_names (proxy); + + if (!props) Already done in commit 327d35ed414b845e0199a11e8bcbb5296ad70c95.
That will fix the crash. The other part avoids making the call at all if it's not going to give us anything.
Review of attachment 292900 [details] [review]: Still needs work... ::: gio/gnetworkmonitornm.c @@ +263,3 @@ + name_owner = g_dbus_proxy_get_name_owner (proxy); + + if (!proxy || !name_owner) Leaking the proxy here if there's no name owner.
Created attachment 294308 [details] [review] gnetworkmonitornm: Check if network-manager is running We were asking for properties on NM's dbus interface, but if NM is not running then there won't be any, so we were crashing. Check if the name has an owner before doing anything to it.
Review of attachment 294308 [details] [review]: ::: gio/gnetworkmonitornm.c @@ +260,3 @@ error); + + if (proxy) if (!proxy) return FALSE; name_owner = ...
Since there are no words, I have to guess that I think you're asking for a style change..? Like this?
Created attachment 294331 [details] [review] gnetworkmonitornm: Check if network-manager is running We were asking for properties on NM's dbus interface, but if NM is not running then there won't be any. Check if the name has an owner before doing anything to it.
Review of attachment 294331 [details] [review]: Looks good.
please push
Attachment 294331 [details] pushed as f7be461 - gnetworkmonitornm: Check if network-manager is running