summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-05-17 15:08:42 +0200
committerLubomir Rintel <lkundrak@v3.sk>2019-05-17 15:13:14 +0200
commit03167134cf3fe6edc419e4638a91b705bea1165d (patch)
treed7e146bc7afc424eafafab2f3f3cea2a5c9be324
parentdc2ef4250e120c6f778a84d9f6e3e9c849908348 (diff)
downloadNetworkManager-lr/set-state-ref.tar.gz
device: keep a NMDevice reference during a deferred state setlr/set-state-ref
When the device has been surprise removed, it could be that all the live references will go away during the state change: [manager abruptly removes enp0s26u1u2i19 device, because a modem claims it] <info> [1558090169.7758] device (enp0s26u1u2i19): state change: activated -> deactivating (reason 'connection-removed', sys-iface-state: 'managed') <info> [1558090169.8108] device (enp0s26u1u2i19): state change: deactivating -> disconnected (reason 'connection-removed', sys-iface-state: 'managed') <info> [1558090170.3252] dhcp4 (enp0s26u1u2i19): canceled DHCP transaction, DHCP client pid 954 <info> [1558090170.3253] dhcp4 (enp0s26u1u2i19): state changed bound -> done ((src/nm-dispatcher.c:543)): assertion '<dropped>' failed g_object_notify_by_pspec: assertion 'G_IS_OBJECT (object)' failed g_object_notify_by_pspec: assertion 'G_IS_OBJECT (object)' failed g_object_notify_by_pspec: assertion 'G_IS_OBJECT (object)' failed g_object_notify_by_pspec: assertion 'G_IS_OBJECT (object)' failed ((src/devices/nm-device.c:1391)): assertion '<dropped>' failed g_object_notify_by_pspec: assertion 'G_IS_OBJECT (object)' failed <warn> [1558090170.3296] device [null]: remove_pending_action (1): 'queued-state-change-disconnected' not pending file src/devices/nm-device.c: line 14244 (<dropped>): should not be reached
-rw-r--r--src/devices/nm-device.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 38582937e4..77a8e99ebc 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -15212,6 +15212,8 @@ queued_state_set (gpointer user_data)
nm_assert (priv->queued_state.id);
+ g_object_ref (self);
+
_LOGD (LOGD_DEVICE, "queue-state[%s, reason:%s, id:%u]: %s",
nm_device_state_to_str (priv->queued_state.state),
reason_to_string_a (priv->queued_state.reason),
@@ -15228,6 +15230,8 @@ queued_state_set (gpointer user_data)
nm_device_state_changed (self, new_state, new_reason);
nm_device_remove_pending_action (self, queued_state_to_string (new_state), TRUE);
+ g_object_unref (self);
+
return G_SOURCE_REMOVE;
}