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
This commit is contained in:
Wen Liang 2023-08-03 10:16:42 -04:00 committed by Wen Liang
parent 9fab55ad4c
commit 712729f652

View file

@ -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. */