mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-05 08:00:15 +01:00
nmcli: avoid calling twice "check_activated()" on "nmcli connection up"
This happens when the connection is in "activating" state and the connection is a master one waiting for slaves: "check_activated()" is called by the active_connection_state_cb() and device_state_cb() callbacks. If the device has already moved to a state >= NM_DEVICE_STATE_IP_CONFIG, the call to active_connection_state_cb() will end calling activate_connection_info_finish(), freeing the "info" object. The subsequent call to device_state_cb() will result in accessing the freed "info". Just call check_activated() once after registering the active_connection_state() and device_state_cb() callbacks.
This commit is contained in:
parent
95e7914e67
commit
3d4d1bedda
1 changed files with 9 additions and 10 deletions
|
|
@ -2373,17 +2373,16 @@ activate_connection_cb (GObject *client, GAsyncResult *result, gpointer user_dat
|
|||
}
|
||||
activate_connection_info_finish (info);
|
||||
} else {
|
||||
/* Monitor the active connection state state */
|
||||
g_signal_connect (G_OBJECT (active), "state-changed", G_CALLBACK (active_connection_state_cb), info);
|
||||
active_connection_state_cb (active,
|
||||
nm_active_connection_get_state (active),
|
||||
nm_active_connection_get_state_reason (active),
|
||||
info);
|
||||
|
||||
if (device) {
|
||||
/* Monitor the active connection and device (if available) states */
|
||||
g_signal_connect (active, "state-changed", G_CALLBACK (active_connection_state_cb), info);
|
||||
if (device)
|
||||
g_signal_connect (device, "notify::" NM_DEVICE_STATE, G_CALLBACK (device_state_cb), info);
|
||||
device_state_cb (device, NULL, info);
|
||||
}
|
||||
/* Both active_connection_state_cb () and device_state_cb () will just
|
||||
* call check_activated (info). So, just call it once directly after
|
||||
* connecting on both the signals of the objects and skip the call to
|
||||
* the callbacks.
|
||||
*/
|
||||
check_activated (info);
|
||||
|
||||
/* Start progress indication showing VPN states */
|
||||
if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue