From 25aa6c0552b197f696eb3e8cecdd7ee577eabfeb Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 3 Jan 2022 20:34:46 +0100 Subject: [PATCH] libnm: don't clear secrets during NMSimpleConnection:dispose() NMConnection is an interface, implemented by NMSimpleConnection and NMRemoteConnection. A connection is basically a set of NMSetting instances. Usually you would expect that one NMSetting instance only gets added to zero or one NMConnection. It seems a bit ugly, to have one setting tracked by multiple NMConnection. Still, technically I am not aware of a single problem with doing that, where it not for NMSimpleConnection:dispose() to clear the secrets. There is no need to clear the secrets of an NMSetting, when the NMConnection gets destroyed. Either this destroys the NMSetting instance right away (and NMSetting's destructor will clear the secrets anyway), or somebody else (e.g. another NMConnection instance), keeps the setting alive. In the latter case, it is wrong to clear the secrets at this point. This was done since commit 6a19e68a7d85 ('libnm-core: clear secrets from NMSimpleConnection and NMSettingsConnection dispose()'), but let's stop doing that. This also causes problems in practice, see [1]. [1] https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1099#note_1334333 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/876 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1056 --- src/libnm-core-impl/nm-simple-connection.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libnm-core-impl/nm-simple-connection.c b/src/libnm-core-impl/nm-simple-connection.c index 5039b13b91..6252dc2ce3 100644 --- a/src/libnm-core-impl/nm-simple-connection.c +++ b/src/libnm-core-impl/nm-simple-connection.c @@ -164,8 +164,6 @@ dispose(GObject *object) (gpointer) &_nm_assert_connection_unchanging_user_data); #endif - nm_connection_clear_secrets(connection); - _nm_connection_private_clear(_GET_PRIVATE(connection)); G_OBJECT_CLASS(nm_simple_connection_parent_class)->dispose(object);