
// call from plasma-nm received
(gdb) bt
#0 impl_manager_add_and_activate_connection (self=0x55f893b15060, context=0x7f2c6002e640, settings=0x55f893dbf700, device_path=0x7f2c6002c130 "/org/freedesktop/NetworkManager/Devices/4", specific_object_path=0x7f2c6001de40 "/org/freedesktop/NetworkManager/AccessPoint/86") at /usr/src/debug/net-misc/networkmanager-1.10.2/NetworkManager-1.10.2/src/nm-manager.c:4222
#1 0x00007f2c6ea35fae in ffi_call_unix64 () from target:/usr/lib64/libffi.so.6
#2 0x00007f2c6ea3591f in ffi_call () from target:/usr/lib64/libffi.so.6
#3 0x00007f2c71367acf in g_cclosure_marshal_generic (closure=closure@entry=0x55f893b6c080, return_gvalue=return_gvalue@entry=0x0, n_param_values=n_param_values@entry=5, param_values=param_values@entry=0x55f893d70f00, invocation_hint=invocation_hint@entry=0x7ffeface7900, marshal_data=<optimized out>) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/gobject/gclosure.c:1490
#4 0x000055f891b3750a in nm_exported_object_meta_marshal (closure=0x55f893b6c080, return_value=0x7ffeface7920, n_param_values=5, param_values=0x55f893d60180, invocation_hint=0x7ffeface7900, marshal_data=<optimized out>) at /usr/src/debug/net-misc/networkmanager-1.10.2/NetworkManager-1.10.2/src/nm-exported-object.c:380
#5 0x00007f2c713670b8 in g_closure_invoke (closure=0x55f893b6c080, return_value=return_value@entry=0x7ffeface7920, n_param_values=5, param_values=param_values@entry=0x55f893d60180, invocation_hint=invocation_hint@entry=0x7ffeface7900) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/gobject/gclosure.c:804
#6 0x00007f2c7137a95a in signal_emit_unlocked_R (node=node@entry=0x55f893af21e0, detail=detail@entry=0, instance=instance@entry=0x7f2c5c005760, emission_return=emission_return@entry=0x7ffeface7a50, instance_and_params=instance_and_params@entry=0x55f893d60180) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/gobject/gsignal.c:3635
#7 0x00007f2c71382750 in g_signal_emitv (instance_and_params=instance_and_params@entry=0x55f893d60180, signal_id=signal_id@entry=33, detail=detail@entry=0, return_value=return_value@entry=0x7ffeface7a50) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/gobject/gsignal.c:3129
#8 0x000055f891add81f in _nmdbus_manager_skeleton_handle_method_call (connection=<optimized out>, sender=<optimized out>, object_path=<optimized out>, interface_name=0x7f2c60034d50 "org.freedesktop.NetworkManager", method_name=0x7f2c6000fdb0 "AddAndActivateConnection", parameters=<optimized out>, invocation=0x7f2c6002e640, user_data=0x7f2c5c005760) at introspection/org.freedesktop.NetworkManager.c:6023
#9 0x00007f2c7168538b in g_dbus_interface_method_dispatch_helper (interface=interface@entry=0x7f2c5c005760, method_call_func=0x55f891add5d4 <_nmdbus_manager_skeleton_handle_method_call>, invocation=invocation@entry=0x7f2c6002e640) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/gio/gdbusinterfaceskeleton.c:609
#10 0x00007f2c7168589f in skeleton_intercept_handle_method_call (connection=<optimized out>, sender=sender@entry=0x7f2c60007060 ":1.55", object_path=object_path@entry=0x55f893be2db0 "/org/freedesktop/NetworkManager", interface_name=interface_name@entry=0x7f2c60034d50 "org.freedesktop.NetworkManager", method_name=method_name@entry=0x7f2c6000fdb0 "AddAndActivateConnection", parameters=parameters@entry=0x55f893d8b2f0, invocation=0x7f2c6002e640, user_data=0x7f2c5c005760) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/gio/gdbusinterfaceskeleton.c:651
#11 0x00007f2c7166c3d5 in call_in_idle_cb (user_data=0x7f2c6002e640, user_data@entry=<error reading variable: value has been optimized out>) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/gio/gdbusconnection.c:4850
#12 0x00007f2c70e83af9 in g_idle_dispatch (source=source@entry=0x7f2c60010e00, callback=<optimized out>, user_data=<optimized out>) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/glib/gmain.c:5586
#13 0x00007f2c70e84858 in g_main_dispatch (context=context@entry=0x55f893ac71b0) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/glib/gmain.c:3234
#14 0x00007f2c70e87313 in g_main_context_dispatch (context=context@entry=0x55f893ac71b0) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/glib/gmain.c:3899
#15 0x00007f2c70e8748c in g_main_context_iterate (context=0x55f893ac71b0, block=block@entry=1, dispatch=dispatch@entry=1, self=self@entry=0x55f893b17aa0) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/glib/gmain.c:3972
#16 0x00007f2c70e87830 in g_main_loop_run (loop=0x55f893ac2790) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/glib/gmain.c:4168
#17 0x000055f891aa57e1 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/net-misc/networkmanager-1.10.2/NetworkManager-1.10.2/src/main.c:442

(gdb) set print elements 0
(gdb) print g_variant_print(settings, 1)
$6 = (gchar *) 0x55f893d721c0 "{'802-11-wireless': {'mac-address-randomization': <0>, 'mode': <'infrastructure'>, 'powersave': <0>, 'security': <'802-11-wireless-security'>, 'ssid': <[byte 0x54, 0x65, 0x6c, 0x69, 0x61, 0x2d, 0x39, 0x45, 0x31, 0x42, 0x39, 0x45]>}, '802-11-wireless-security': {'key-mgmt': <'wpa-psk'>, 'psk': <'111111111'>, 'psk-flags': <1>}, 'connection': {'autoconnect-slaves': <-1>, 'id': <'Telia-9E1B9E'>, 'lldp': <-1>, 'metered': <0>, 'permissions': <['user:mart:']>, 'type': <'802-11-wireless'>, 'uuid': <'2179a1e8-16a2-4ec1-a693-8cf34a89a261'>}}"

// agent secrets cleared here
(gdb) bt
#0 nm_settings_connection_update (self=self@entry=0x55f893c4f370, new_connection=new_connection@entry=0x0, persist_mode=persist_mode@entry=NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK, commit_reason=commit_reason@entry=(NM_SETTINGS_CONNECTION_COMMIT_REASON_USER_ACTION | NM_SETTINGS_CONNECTION_COMMIT_REASON_ID_CHANGED), log_diff_name=log_diff_name@entry=0x55f891c72b0f "add-and-activate", error=error@entry=0x0) at /usr/src/debug/net-misc/networkmanager-1.10.2/NetworkManager-1.10.2/src/settings/nm-settings-connection.c:633
#1 0x000055f891ace058 in activation_add_done (settings=settings@entry=0x55f893ae1380, new_connection=new_connection@entry=0x55f893c4f370, error=0x0, context=context@entry=0x7f2c60029800, subject=subject@entry=0x55f893d61340, user_data=user_data@entry=0x55f893c20f80) at /usr/src/debug/net-misc/networkmanager-1.10.2/NetworkManager-1.10.2/src/nm-manager.c:4121
#2 0x000055f891bed8d2 in pk_add_cb (chain=0x55f893b2ede0, chain_error=<optimized out>, context=0x7f2c60029800, user_data=0x55f893ae1380) at /usr/src/debug/net-misc/networkmanager-1.10.2/NetworkManager-1.10.2/src/settings/nm-settings.c:1179
#3 0x000055f891c0fb26 in auth_chain_finish (user_data=0x55f893b2ede0, user_data@entry=<error reading variable: value has been optimized out>) at /usr/src/debug/net-misc/networkmanager-1.10.2/NetworkManager-1.10.2/src/nm-auth-utils.c:93
#4 0x00007f2c70e83af9 in g_idle_dispatch (source=source@entry=0x55f893d19b50, callback=<optimized out>, user_data=<optimized out>) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/glib/gmain.c:5586
#5 0x00007f2c70e84858 in g_main_dispatch (context=context@entry=0x55f893ac71b0) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/glib/gmain.c:3234
#6 0x00007f2c70e87313 in g_main_context_dispatch (context=context@entry=0x55f893ac71b0) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/glib/gmain.c:3899
#7 0x00007f2c70e8748c in g_main_context_iterate (context=0x55f893ac71b0, block=block@entry=1, dispatch=dispatch@entry=1, self=self@entry=0x55f893b17aa0) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/glib/gmain.c:3972
#8 0x00007f2c70e87830 in g_main_loop_run (loop=0x55f893ac2790) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/glib/gmain.c:4168
#9 0x000055f891aa57e1 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/net-misc/networkmanager-1.10.2/NetworkManager-1.10.2/src/main.c:442

// try to send agent secrets here
(gdb) bt
#0 nm_secret_agent_save_secrets (self=0x55f893d0de80, path=0x55f893d8c830 "/org/freedesktop/NetworkManager/Settings/82", connection=0x55f893c50180, callback=callback@entry=0x55f891be03c2 <_con_save_request_done>, callback_data=callback_data@entry=0x55f893cfce60) at /usr/src/debug/net-misc/networkmanager-1.10.2/NetworkManager-1.10.2/src/settings/nm-secret-agent.c:527
#1 0x000055f891bdcb24 in _con_save_request_start (req=req@entry=0x55f893cfce60) at /usr/src/debug/net-misc/networkmanager-1.10.2/NetworkManager-1.10.2/src/settings/nm-agent-manager.c:1334
#2 0x000055f891bdc47e in request_next_agent (req=req@entry=0x55f893cfce60) at /usr/src/debug/net-misc/networkmanager-1.10.2/NetworkManager-1.10.2/src/settings/nm-agent-manager.c:764
#3 0x000055f891bddd64 in request_start (user_data=0x55f893cfce60, user_data@entry=<error reading variable: value has been optimized out>) at /usr/src/debug/net-misc/networkmanager-1.10.2/NetworkManager-1.10.2/src/settings/nm-agent-manager.c:838
#4 0x00007f2c70e83af9 in g_idle_dispatch (source=source@entry=0x55f893c979a0, callback=<optimized out>, user_data=<optimized out>) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/glib/gmain.c:5586
#5 0x00007f2c70e84858 in g_main_dispatch (context=context@entry=0x55f893ac71b0) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/glib/gmain.c:3234
#6 0x00007f2c70e87313 in g_main_context_dispatch (context=context@entry=0x55f893ac71b0) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/glib/gmain.c:3899
#7 0x00007f2c70e8748c in g_main_context_iterate (context=0x55f893ac71b0, block=block@entry=1, dispatch=dispatch@entry=1, self=self@entry=0x55f893b17aa0) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/glib/gmain.c:3972
#8 0x00007f2c70e87830 in g_main_loop_run (loop=0x55f893ac2790) at /usr/src/debug/dev-libs/glib-2.52.3/glib-2.52.3/glib/gmain.c:4168
#9 0x000055f891aa57e1 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/net-misc/networkmanager-1.10.2/NetworkManager-1.10.2/src/main.c:442

// patch that seems to fix the issue
// inspired by https://bugzilla.gnome.org/show_bug.cgi?id=789383
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 7f1b9a9..07e0254 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -4118,7 +4118,8 @@ activation_add_done (NMSettings *settings,
                nm_active_connection_set_settings_connection (active, new_connection);
 
                if (_internal_activate_generic (self, active, &local)) {
-                       nm_settings_connection_update (new_connection,
+                       NMSettingsConnection *copy = nm_simple_connection_new_clone (new_connection);
+                       nm_settings_connection_update (copy,
                                                       NULL,
                                                       NM_SETTINGS_CONNECTION_PERSIST_MODE_DISK,
                                                       NM_SETTINGS_CONNECTION_COMMIT_REASON_USER_ACTION | NM_SETTINGS_CONNECTION_COMMIT_REASON_ID_CHANGED,
