mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-09 22:50:21 +01:00
libnm: take reference to settings in nm_connection_for_each_setting_value()
As we iterate over the settings, let's ensure that they stay
alive while we call back to the user data.
(cherry picked from commit 207b101238)
This commit is contained in:
parent
eb10539b80
commit
4949434dac
1 changed files with 6 additions and 1 deletions
|
|
@ -2589,14 +2589,19 @@ nm_connection_for_each_setting_value(NMConnection * connection,
|
|||
gpointer user_data)
|
||||
{
|
||||
gs_free NMSetting **settings = NULL;
|
||||
guint i, length = 0;
|
||||
guint length = 0;
|
||||
guint i;
|
||||
|
||||
g_return_if_fail(NM_IS_CONNECTION(connection));
|
||||
g_return_if_fail(func);
|
||||
|
||||
settings = nm_connection_get_settings(connection, &length);
|
||||
for (i = 1; i < length; i++)
|
||||
g_object_ref(settings[i]);
|
||||
for (i = 0; i < length; i++)
|
||||
nm_setting_enumerate_values(settings[i], func, user_data);
|
||||
for (i = 1; i < length; i++)
|
||||
g_object_unref(settings[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue