mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-05 12:30:44 +02:00
core: don't take reference on NMDevice to track auto-activate
Add an assertion to nm_policy_device_recheck_auto_activate_schedule(), that the device is currently registered in NMPolicy. Calling it outside would be odd, and likely a bug. But if we only register the auto-activate while being registered, we don't need to take an additional reference. We know that the object must be be alive (also, we have assertions that in fact it is still alive).
This commit is contained in:
parent
a22e5080a0
commit
0dd4724446
1 changed files with 8 additions and 2 deletions
|
|
@ -1460,7 +1460,6 @@ _auto_activate_device_clear(NMPolicy *self, NMDevice *device, gboolean do_activa
|
|||
_auto_activate_device(self, device);
|
||||
|
||||
nm_device_remove_pending_action(device, NM_PENDING_ACTION_AUTOACTIVATE, TRUE);
|
||||
g_object_unref(device);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
@ -1663,6 +1662,14 @@ 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 (!c_list_is_empty(&device->policy_auto_activate_lst)) {
|
||||
/* already queued. Return. */
|
||||
|
|
@ -1691,7 +1698,6 @@ nm_policy_device_recheck_auto_activate_schedule(NMPolicy *self, NMDevice *device
|
|||
|
||||
c_list_link_tail(&priv->policy_auto_activate_lst_head, &device->policy_auto_activate_lst);
|
||||
device->policy_auto_activate_idle_source = nm_g_idle_add_source(_auto_activate_idle_cb, device);
|
||||
g_object_ref(device);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue