diff options
author | Wen Liang <liangwen12year@gmail.com> | 2023-08-03 10:16:42 -0400 |
---|---|---|
committer | Wen Liang <wenliang@redhat.com> | 2023-08-17 07:23:51 -0400 |
commit | 712729f6523f2e41a6c78e9a4f4d36a17d9464bd (patch) | |
tree | ffb75be0b534a4f637b01dee0fca8fc858188b8f | |
parent | 9fab55ad4c0872ecff1377f83ff69ea6fb74e332 (diff) |
nm-policy: stop rechecking autoactivation if device is unregistered
If the device is no longer registered to NMPolicy,
`g_signal_handler_find()` can not find the signal handler that was
disconnected before, therefore, there is no need to schedule a check for
autoactivation.
https://bugzilla.redhat.com/show_bug.cgi?id=2210271
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1711
-rw-r--r-- | src/core/nm-policy.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c index efdb06360f..024f76546c 100644 --- a/src/core/nm-policy.c +++ b/src/core/nm-policy.c @@ -1662,14 +1662,15 @@ nm_policy_device_recheck_auto_activate_schedule(NMPolicy *self, NMDevice *device g_return_if_fail(NM_IS_POLICY(self)); g_return_if_fail(NM_IS_DEVICE(device)); - nm_assert(g_signal_handler_find(device, - G_SIGNAL_MATCH_DATA, - 0, - 0, - NULL, - NULL, - NM_POLICY_GET_PRIVATE(self)) - != 0); + if (g_signal_handler_find(device, + G_SIGNAL_MATCH_DATA, + 0, + 0, + NULL, + NULL, + NM_POLICY_GET_PRIVATE(self)) + == 0) + return; if (!c_list_is_empty(&device->policy_auto_activate_lst)) { /* already queued. Return. */ |