[gnome-initial-setup/gbsneto/timezone-regressions: 3/4] timezone: Protect set_location_internal() against reentrancy




commit a760f61817cf7016f2419ddd4a4033403b1ead32
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Aug 15 13:24:20 2022 -0300

    timezone: Protect set_location_internal() against reentrancy
    
    set_location_internal() calls set_entry_text(), which notifies the
    text property, which ends up calling set_location_internal() again.
    Protect against this by blocking the property notification.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-initial-setup/-/issues/145
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-initial-setup/-/merge_requests/157>

 gnome-initial-setup/pages/timezone/gis-location-entry.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gnome-initial-setup/pages/timezone/gis-location-entry.c 
b/gnome-initial-setup/pages/timezone/gis-location-entry.c
index 7aec073f..934fb0ce 100644
--- a/gnome-initial-setup/pages/timezone/gis-location-entry.c
+++ b/gnome-initial-setup/pages/timezone/gis-location-entry.c
@@ -354,6 +354,8 @@ set_location_internal (GisLocationEntry *entry,
 
     g_assert (iter == NULL || loc == NULL);
 
+    g_signal_handlers_block_by_func (entry, entry_changed, NULL);
+
     if (iter) {
         gtk_tree_model_get (model, iter,
                             LOC_GIS_LOCATION_ENTRY_COL_DISPLAY_NAME, &name,
@@ -369,6 +371,8 @@ set_location_internal (GisLocationEntry *entry,
         set_entry_text (entry, "");
     }
 
+    g_signal_handlers_unblock_by_func (entry, entry_changed, NULL);
+
     gtk_editable_set_position (GTK_EDITABLE (entry), -1);
     g_object_notify (G_OBJECT (entry), "location");
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]