From: Thomas Haller Date: Tue, 29 Mar 2016 08:39:47 +0000 (+0200) Subject: policy: remove initialized guard from nm_policy_new() X-Git-Url: https://iam.tj/gitweb/gitweb.cgi?p=NetworkManager.git;a=commitdiff_plain;h=6a7ba9b5e15a970446aff410117072d9e12f2a61 policy: remove initialized guard from nm_policy_new() If we want to ensure that we create only one single instance of NMPolicy, just don't create multiple instances. The nm_policy_new() method should not be restriced and behave like other *new() functions and create a new object as requested. --- diff --git a/src/nm-policy.c b/src/nm-policy.c index e855c4228..f16729ac2 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -1898,19 +1898,13 @@ constructed (GObject *object) NMPolicy * nm_policy_new (NMManager *manager, NMSettings *settings) { - NMPolicy *policy; - static gboolean initialized = FALSE; - g_return_val_if_fail (NM_IS_MANAGER (manager), NULL); g_return_val_if_fail (NM_IS_SETTINGS (settings), NULL); - g_return_val_if_fail (initialized == FALSE, NULL); - - policy = g_object_new (NM_TYPE_POLICY, - NM_POLICY_MANAGER, manager, - NM_POLICY_SETTINGS, settings, - NULL); - initialized = TRUE; - return policy; + + return g_object_new (NM_TYPE_POLICY, + NM_POLICY_MANAGER, manager, + NM_POLICY_SETTINGS, settings, + NULL); } static void