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 6a19e68a7d ('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
This commit is contained in:
Thomas Haller 2022-01-03 20:34:46 +01:00
parent b331606386
commit 25aa6c0552
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

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