mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-24 19:55:26 +03:00
See commit message, downstream bug and upstrem MR: https://gitlab.com/postmarketOS/pmaports/-/issues/1816 https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1545
50 lines
2.3 KiB
Diff
50 lines
2.3 KiB
Diff
commit 911f07618
|
|
Author: Pablo Correa Gómez <ablocorrea@hotmail.com>
|
|
Date: Mon Dec 12 17:44:51 2022 +0100
|
|
|
|
network: avoid segmentation fault in race where no button is pressed
|
|
|
|
This can actually happen, since all the buttons hook up to the "toggled"
|
|
signal.
|
|
|
|
This might also fixed an "use non-initialized variable" warning for the
|
|
"method" variable.
|
|
|
|
Indeed, looking at the GTK4 code, I read the following when clicking
|
|
a button in a radio group:
|
|
|
|
- The button which was previously active gets de-activated, emitting its
|
|
corresponding toggled signal.
|
|
- The active property for the clicked button gets set.
|
|
- The clicked button emits its toggled signal.
|
|
|
|
Therefore, if the first toggle signal gets processed before the active
|
|
property is set, there can be a race condition. We are seeing this downstream
|
|
at pmOS: https://gitlab.com/postmarketOS/pmaports/-/issues/1816
|
|
|
|
diff --git a/panels/network/connection-editor/ce-page-ip4.c b/panels/network/connection-editor/ce-page-ip4.c
|
|
index c3f0864d9..59719c52f 100644
|
|
--- a/panels/network/connection-editor/ce-page-ip4.c
|
|
+++ b/panels/network/connection-editor/ce-page-ip4.c
|
|
@@ -569,6 +569,8 @@ ui_to_setting (CEPageIP4 *self)
|
|
method = NM_SETTING_IP4_CONFIG_METHOD_MANUAL;
|
|
else if (gtk_check_button_get_active (GTK_CHECK_BUTTON (self->shared_radio)))
|
|
method = NM_SETTING_IP4_CONFIG_METHOD_SHARED;
|
|
+ else
|
|
+ return ret;
|
|
|
|
addresses = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_ip_address_unref);
|
|
add_addresses = g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
|
|
diff --git a/panels/network/connection-editor/ce-page-ip6.c b/panels/network/connection-editor/ce-page-ip6.c
|
|
index 09b9eb6f5..ea10010d1 100644
|
|
--- a/panels/network/connection-editor/ce-page-ip6.c
|
|
+++ b/panels/network/connection-editor/ce-page-ip6.c
|
|
@@ -544,6 +544,8 @@ ui_to_setting (CEPageIP6 *self)
|
|
method = NM_SETTING_IP6_CONFIG_METHOD_AUTO;
|
|
else if (gtk_check_button_get_active (self->shared_radio))
|
|
method = NM_SETTING_IP6_CONFIG_METHOD_SHARED;
|
|
+ else
|
|
+ return ret;
|
|
|
|
nm_setting_ip_config_clear_addresses (self->setting);
|
|
if (g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
|