'Automatically connect to VPN' option selects a different VPN every time the UI is opened
Context: I have a home wifi network and want to automatically connect to a specific VPN when I connect to the wifi. I have multiple (~12) VPNs defined in NetworkManager, and selected the desired VPN for my home network using the Edit Connections UI.
The first time I select the VPN, close the editor, and connect/reconnect to my home network, it connects to the correct VPN.
However, if I reopen the connection editor for that network, and choose the General tab, the 'Automatically connect to VPN' option will show a different VPN selected that the one I previously selected. If I then click 'save' without reselecting the original VPN option, it will save the changed VPN, and that is the one that NetworkManager will use next time I reconnect to my home network.
This action can be repeated: each time the Edit Connection UI is opened for a particular network, and the General tab is clicked, it will show a different VPN every time, and presumably would continue overwriting the originally selected VPN.
I had a quick look at the source code and I could imagine that the problem is in populate_ui() from page-general.c, because there is a double indexing in there which may be missing something.
I have attached an example VPN config file which is placed in /etc/NetworkManager/system-connections (with details removed), in case this is useful: vpn-sample-config.nmconnection