From 8ae663ae87e98f4e044de63f43cfaaada50a6e66 Mon Sep 17 00:00:00 2001 From: Barunes Padhy Date: Sun, 16 Nov 2025 14:05:52 +0200 Subject: [PATCH 1/2] Fix crash on captive portal Wi-Fi by ensuring NMConnection is fully initialized --- src/Widgets/WifiInterface.vala | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Widgets/WifiInterface.vala b/src/Widgets/WifiInterface.vala index c7818847..2d05d279 100644 --- a/src/Widgets/WifiInterface.vala +++ b/src/Widgets/WifiInterface.vala @@ -264,15 +264,22 @@ public class Network.WifiInterface : Network.WidgetNMInterface { } var flags = i.ap.get_wpa_flags () | i.ap.get_rsn_flags (); - var is_secured = true; + var is_secured = flags != NM.@80211ApSecurityFlags.NONE; var connection = NM.SimpleConnection.new (); - if (flags != NM.@80211ApSecurityFlags.NONE) { - var s_con = new NM.SettingConnection (); - s_con.uuid = NM.Utils.uuid_generate (); - connection.add_setting (s_con); + // Always create a proper connection and wireless setting for libnma + var s_con = new NM.SettingConnection (); + s_con.uuid = NM.Utils.uuid_generate (); + s_con.id = NM.Utils.ssid_to_utf8 (i.ap.get_ssid ().get_data ()); + s_con.type = NM.SettingWireless.SETTING_NAME; + connection.add_setting (s_con); + var s_wifi = new NM.SettingWireless (); + s_wifi.ssid = i.ap.get_ssid (); + connection.add_setting (s_wifi); + + if (is_secured) { if (NM.@80211ApSecurityFlags.KEY_MGMT_OWE in flags || NM.@80211ApSecurityFlags.KEY_MGMT_OWE_TM in flags) { var s_wsec = new NM.SettingWirelessSecurity (); @@ -286,10 +293,6 @@ public class Network.WifiInterface : Network.WidgetNMInterface { connection.add_setting (s_wsec); } - var s_wifi = new NM.SettingWireless (); - s_wifi.ssid = i.ap.get_ssid (); - connection.add_setting (s_wifi); - // If the AP is WPA[2]-Enterprise then we need to set up a minimal 802.1x setting before // prompting the user to configure the authentication, otherwise, the dialog works out // what sort of credentials to prompt for automatically From 7adda81f780d4880b1bfdc92d833e21050275d3f Mon Sep 17 00:00:00 2001 From: Barunes Padhy Date: Sun, 23 Nov 2025 16:54:11 +0200 Subject: [PATCH 2/2] Removed redundant if condition --- src/Widgets/WifiInterface.vala | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Widgets/WifiInterface.vala b/src/Widgets/WifiInterface.vala index 2d05d279..16e51b55 100644 --- a/src/Widgets/WifiInterface.vala +++ b/src/Widgets/WifiInterface.vala @@ -306,9 +306,7 @@ public class Network.WifiInterface : Network.WidgetNMInterface { s_8021x.phase2_auth = "mschapv2"; connection.add_setting (s_8021x); } - } - if (is_secured) { // In theory, we could just activate normal WEP/WPA connections without spawning a WifiDialog // and NM would create its own dialog, but Mutter's focus stealing prevention often hides it // so we spawn our own