settings: don't implement settings plugins as singletons
The settings plugins are created by NMSettings when the plugin gets loaded. There is no need for these instances to be singletons or to have a singleton getter. Also, while in practice we create a settings plugin instance of each type only once, there is nothing that would prevent creating multiple instances. Hence, having a singleton getter is not right. What is however useful, is to track them and block shutdown via nm_shutdown_wait_obj_register*(). While the actual waiting is not yet implemented, we should mark the plugin instances to block shutdown (in the future).
This commit is contained in:
@@ -1255,6 +1255,10 @@ add_plugin (NMSettings *self,
|
||||
|
||||
priv->plugins = g_slist_append (priv->plugins, g_object_ref (plugin));
|
||||
|
||||
nm_shutdown_wait_obj_register_full (G_OBJECT (plugin),
|
||||
g_strdup_printf ("%s-settings-plugin", pname),
|
||||
TRUE);
|
||||
|
||||
_LOGI ("Loaded settings plugin: %s (%s%s%s)",
|
||||
pname,
|
||||
NM_PRINT_FMT_QUOTED (path, "\"", path, "\"", "internal"));
|
||||
|
Reference in New Issue
Block a user