Defer busname ownership until init complete
Avoid race conditions where applications expecting an object to be
present upon recipt of NameOwnerChanged find that the object hasn't
been created yet.
Change-Id: I4236a3898055a84b00e1eaf37f32e0192b683a0f
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/pydownloadmgr/download_manager.py b/pydownloadmgr/download_manager.py
index 9dd6c2d..aeb85c7 100644
--- a/pydownloadmgr/download_manager.py
+++ b/pydownloadmgr/download_manager.py
@@ -71,9 +71,9 @@
if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = get_dbus()
- name = dbus.service.BusName(DBUS_NAME, bus)
obj = DownloadManagerObject(bus, OBJ_NAME)
mainloop = gobject.MainLoop()
+ name = dbus.service.BusName(DBUS_NAME, bus)
print "Running Download Manager"
mainloop.run()