GNOME Bugzilla – Bug 652361
region: fix infinite loop dealing with gsettings 'changed' signal
Last modified: 2011-06-12 13:08:19 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.
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.
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.
that is nice! thanks, committed.