diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2014-03-31 17:33:52 +0200 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2014-03-31 18:10:55 +0200 |
commit | 4209f170dad319752580386e56bc51c412769220 (patch) | |
tree | 647e9c82023c342b2bb918f957efc19348cfa7f1 | |
parent | a2597c08168b87f5107cff6befda8b9118015ccc (diff) | |
download | NetworkManager-4209f170dad319752580386e56bc51c412769220.tar.gz |
nmcli: fix an error when showing progress of activation in editor
(process:7213): CRITICAL **: nm_active_connectiuon_get_state: assertion `NM_IS_ACTIVE_CONNECTION (connection)' failed
-rw-r--r-- | cli/src/connections.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/cli/src/connections.c b/cli/src/connections.c index 1a3f7b3730..33c94566d1 100644 --- a/cli/src/connections.c +++ b/cli/src/connections.c @@ -6381,7 +6381,7 @@ progress_activation_editor_cb (gpointer user_data) NMDeviceState dev_state; if (!device || !ac) - return FALSE; + goto finish; ac_state = nm_active_connection_get_state (ac); dev_state = nm_device_get_state (device); @@ -6393,15 +6393,22 @@ progress_activation_editor_cb (gpointer user_data) nmc_terminal_erase_line (); printf (_("Connection successfully activated (D-Bus active path: %s)\n"), nm_object_get_path (NM_OBJECT (ac))); - return FALSE; /* we are done */ + goto finish; /* we are done */ } else if ( ac_state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED - || ac_state == NM_ACTIVE_CONNECTION_STATE_UNKNOWN) { + || dev_state == NM_DEVICE_STATE_FAILED) { nmc_terminal_erase_line (); printf (_("Error: Connection activation failed.\n")); - return FALSE; /* we are done */ + goto finish; /* we are done */ } return TRUE; + +finish: + if (device) + g_object_unref (device); + if (ac) + g_object_unref (ac); + return FALSE; } static void @@ -6422,8 +6429,8 @@ activate_connection_editor_cb (NMClient *client, } if (device) { monitor_ac_info = g_malloc0 (sizeof (AddConnectionInfo)); - monitor_ac_info->device = device; - monitor_ac_info->ac = active; + monitor_ac_info->device = g_object_ref (device); + monitor_ac_info->ac = active ? g_object_ref (active) : NULL; monitor_ac_info->monitor_id = g_timeout_add (120, progress_activation_editor_cb, monitor_ac_info); } } |