mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 02:57:58 +02:00
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:
parent
caebe764a5
commit
6a7ba9b5e1
1 changed files with 4 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue