After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 652361 - region: fix infinite loop dealing with gsettings 'changed' signal
region: fix infinite loop dealing with gsettings 'changed' signal
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Region & Language
unspecified
Other All
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-06-11 17:05 UTC by Rui Matos
Modified: 2011-06-12 13:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
region: fix infinite loop dealing with gsettings 'changed' signal (1.91 KB, patch)
2011-06-11 17:05 UTC, Rui Matos
none Details | Review
region: fix infinite loop dealing with gsettings 'changed' signal (4.42 KB, patch)
2011-06-12 00:20 UTC, Rui Matos
none Details | Review

Description Rui Matos 2011-06-11 17:05:44 UTC
This patch fixes an infinite loop when dealing with keyboard layouts like
adding/removing or clicking "Reset to Defaults". It can also happen by just
opening the Region panel.
Comment 1 Rui Matos 2011-06-11 17:05:47 UTC
Created attachment 189734 [details] [review]
region: fix infinite loop dealing with gsettings 'changed' signal

Setting updating_settings in update_layouts_list() and checking for it in the
gsettings 'changed' signal handler doesn't prevent a loop because the signal
handler is only called after update_layouts_list() returns and thus
updating_settings is already FALSE at that point.

Inverting the logic and setting updating_settings to TRUE around
xkb_layouts_fill_selected_tree() and then checking for it in
update_layouts_list() does prevent the loop.
Comment 2 Rui Matos 2011-06-12 00:20:49 UTC
Created attachment 189744 [details] [review]
region: fix infinite loop dealing with gsettings 'changed' signal

Setting updating_settings in update_layouts_list() and checking for it in the
gsettings 'changed' signal handler doesn't prevent a loop because the signal
handler is only called after update_layouts_list() returns and thus
updating_settings is already FALSE at that point.

By using the 'drag-end' signal instead of 'row-inserted', etc. we continue to
support DnD re-ordering of layouts while avoiding the loop from
xkb_layouts_fill_selected_tree() deleting and inserting rows into the model.

The previous version of this patch was causing a segfault when DnD'ing layouts
in the TreeView.
Comment 3 Sergey V. Udaltsov 2011-06-12 13:08:19 UTC
that is nice! thanks, committed.