[PATCH] core: fix singleton handling in NULL/systemd session monitor



---
 src/nm-session-monitor-null.c    |    4 +++-
 src/nm-session-monitor-systemd.c |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/nm-session-monitor-null.c b/src/nm-session-monitor-null.c
index ec33bef..14d756f 100644
--- a/src/nm-session-monitor-null.c
+++ b/src/nm-session-monitor-null.c
@@ -84,7 +84,9 @@ nm_session_monitor_get (void)
 	if (singleton)
 		return g_object_ref (singleton);
 
-	return NM_SESSION_MONITOR (g_object_new (NM_TYPE_SESSION_MONITOR, NULL));
+	singleton = NM_SESSION_MONITOR (g_object_new (NM_TYPE_SESSION_MONITOR, NULL));
+	assert (singleton);
+	return singleton;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
diff --git a/src/nm-session-monitor-systemd.c b/src/nm-session-monitor-systemd.c
index ae09494..8fe73ae 100644
--- a/src/nm-session-monitor-systemd.c
+++ b/src/nm-session-monitor-systemd.c
@@ -195,7 +195,9 @@ nm_session_monitor_get (void)
 	if (singleton)
 		return g_object_ref (singleton);
 
-	return NM_SESSION_MONITOR (g_object_new (NM_TYPE_SESSION_MONITOR, NULL));
+	singleton = NM_SESSION_MONITOR (g_object_new (NM_TYPE_SESSION_MONITOR, NULL));
+	assert (singleton);
+	return singleton;
 }
 
 gboolean
-- 
1.7.8.3



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]