summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-03-29 10:50:34 +0200
committerThomas Haller <thaller@redhat.com>2018-04-13 09:09:46 +0200
commit24c3eacac6a6bb9b0574fa6d33b4083b6f55a90f (patch)
tree0b60927ce116cd8eaa2d01fd69ab9f408c78ddda
parentf41279ca1dc14faae433d4c4492b7e2cc49aefaf (diff)
downloadNetworkManager-24c3eacac6a6bb9b0574fa6d33b4083b6f55a90f.tar.gz
settings/trivial: add code comments
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c
index e66ecfdccc..bc0ad448af 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c
@@ -326,7 +326,10 @@ update_connection (SettingsPluginIfcfg *self,
if (new_unmanaged || new_unrecognized) {
if (!old_unmanaged && !old_unrecognized) {
+ /* ref connection first, because we put it into priv->connections below.
+ * Emitting signal-removed might otherwise delete it. */
g_object_ref (connection_by_uuid);
+
/* Unexport the connection by telling the settings service it's
* been removed.
*/
@@ -340,7 +343,7 @@ update_connection (SettingsPluginIfcfg *self,
*/
g_hash_table_insert (priv->connections,
g_strdup (nm_connection_get_uuid (NM_CONNECTION (connection_by_uuid))),
- connection_by_uuid);
+ connection_by_uuid/*<< took reference above*/);
}
} else {
if (old_unmanaged /* && !new_unmanaged */) {
@@ -372,7 +375,9 @@ update_connection (SettingsPluginIfcfg *self,
_LOGI ("add connection "NM_IFCFG_CONNECTION_LOG_FMT, NM_IFCFG_CONNECTION_LOG_ARG (connection_new));
else
_LOGI ("new connection "NM_IFCFG_CONNECTION_LOG_FMT, NM_IFCFG_CONNECTION_LOG_ARG (connection_new));
- g_hash_table_insert (priv->connections, g_strdup (uuid), connection_new);
+ g_hash_table_insert (priv->connections,
+ g_strdup (uuid),
+ connection_new /* take reference */);
g_signal_connect (connection_new, NM_SETTINGS_CONNECTION_REMOVED,
G_CALLBACK (connection_removed_cb),