summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWen Liang <liangwen12year@gmail.com>2023-08-03 10:16:42 -0400
committerWen Liang <liangwen12year@gmail.com>2023-08-20 18:01:41 -0400
commit02fc51f9637dad75b41c6adf5085074a456b7be0 (patch)
treeffb75be0b534a4f637b01dee0fca8fc858188b8f
parent9fab55ad4c0872ecff1377f83ff69ea6fb74e332 (diff)
nm-policy: stop rechecking autoactivation if device is unregisteredwl/nm_policy_dev_unregister_fix
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.c17
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. */