Repository navigation
network applet: fix duplicate rows when a network gains a profile - #14076
Merged
clefebvre merged 1 commit intoNov 2, 2026
Merged
Conversation
A new access point can make another saved profile valid for a Wi-Fi network that is already listed: one locked to a BSSID or band, or a WPA3 profile when only one band offers WPA3. Since linuxmint#12417, _accessPointAdded() then calls _accessPointRemoved() on the access point it has just added, to take the network out of the menu before re-inserting it. But _accessPointRemoved() only destroys the item when the network's last access point goes, and this network keeps its others. So the old row stayed and a second one was added. The new access point was also dropped, so a profile valid only there could not be activated from its row. The extra rows could pile up each time the network went and came back, and stayed after it had gone until the next rebuild. The re-insertion, older than linuxmint#12417, also gave the connected network a row, which it should not have. Sort and rebuild the section instead, as addConnection() does; that also keeps the More submenu right. The event is rare, but it can come while the menu is open, since opening the menu starts a scan. As on any other rebuild, an expanded submenu in the section then closes, and the menu may close if a row in the section has the key focus. A new network is not affected: its access point is in no list yet, so the call did nothing there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a new access point (BSS) makes another saved profile valid for a Wi-Fi network that is already listed,
_accessPointAdded()calls_accessPointRemoved()on the access point it has just added, then inserts a new item. #12417 added that call to take the network out of the menu first, but_accessPointRemoved()only destroys the item when the network's last access point goes. So:It happens with a profile locked to a BSSID or band, or a WPA3 profile when only one band offers WPA3. The fix sorts and rebuilds the section, as
addConnection()does. That also keeps the More submenu right and gives the connected network no row; the re-insertion, older than #12417, gave it one. Only this rare event rebuilds; a new network is still inserted in place. As with any rebuild, if the menu is open at that moment, an expanded Wi-Fi submenu closes, and the menu may close if one of its Wi-Fi rows has the keyboard focus.This goes with #14075; the two are meant to be merged together. On master, a network with two or more saved profiles stops at the TypeError that PR fixes before it gets here, so with that PR alone it reaches this bug. Each applies cleanly with or without the other, and with #14073 and #14074.
To reproduce, use a dual-band network you are not connected to and have no saved profile for, where both bands show the same security in
nmcli -f SSID,CHAN,SECURITY dev wifi listand you can switch 5 GHz off on its own, such as a router. Switch 5 GHz off, wait until that command shows only the 2.4 GHz row, and add a profile locked to 5 GHz (usesaefor a WPA3-only network):Switch 5 GHz back on (
nmcli dev wifi rescanspeeds this up). On master the network gets a second row, and switching the whole network off leaves one behind until the menu is next rebuilt. With this change it has one row, and none is left. Don't click t1; clean up withnmcli connection delete t1.Not changed here: a profile whose only BSS goes away stays listed.
Tested on: the same setup as #14075, with throwaway profiles locked to one band. One saved profile plus a 2.4 GHz-locked one, with 5 GHz back first: before this change (master's code here) the 2.4 GHz BSS was dropped and a second row stayed after the hotspot went off; with both changes the section was rebuilt once and one row tracked both bands. One locked profile per band: #14075 alone added a row each cycle; with both changes, none. Not tested: this change without #14075.
AI assistance: written with help from Claude Opus 5.5 (Anthropic); I reviewed it and tested it on my own machine.