core: make NMSessionMonitor non-refcounted

and ensure that main() frees the singleton before exiting
This commit is contained in:
Dan Winship
2013-11-05 14:43:31 -05:00
parent 6e73f01b6e
commit 37b8983c39
7 changed files with 25 additions and 44 deletions

View File

@@ -81,11 +81,8 @@ nm_session_monitor_get (void)
{
static NMSessionMonitor *singleton = NULL;
if (singleton)
return g_object_ref (singleton);
singleton = NM_SESSION_MONITOR (g_object_new (NM_TYPE_SESSION_MONITOR, NULL));
g_assert (singleton);
if (!singleton)
singleton = g_object_new (NM_TYPE_SESSION_MONITOR, NULL);
return singleton;
}