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.
This commit is contained in:
Thomas Haller 2016-03-29 10:39:47 +02:00
parent caebe764a5
commit 6a7ba9b5e1

View file

@ -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