diff options
author | António Fernandes <antoniof@gnome.org> | 2023-04-25 20:33:45 +0100 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2023-04-25 20:44:45 +0100 |
commit | 5542f07cefcdbe8a7a110cbeead9043ef7cb6e65 (patch) | |
tree | 16fad51a319beafc4aeb29f0c7a7c7fbad0af9b5 | |
parent | 0667eee40c342d8077e2954f674a6a7b135c3520 (diff) | |
download | nautilus-wip/antoniof/searching_search_visible.tar.gz |
query-editor: Don't trigger search once clearedwip/antoniof/searching_search_visible
We trigger search after a short time interval after the user stops
typing, as a performance saving measure.
To implement that behaviour, we need to ignore text changes that
are done programatically and not by the user typing. In that case,
we don't setup the timer that triggers the search.
But in that case we also don't clear a previously set timer. Although
the previous commit has already fixed the visible effects of this bug,
the timed callback is still called, which may cause other unknown bugs.
So, let's always clear the timer when the search text changes, even
if programatically, such as when clearing the text when closing search.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2875
-rw-r--r-- | src/nautilus-query-editor.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c index 7de9dddd6..48f5435c3 100644 --- a/src/nautilus-query-editor.c +++ b/src/nautilus-query-editor.c @@ -407,12 +407,13 @@ static void entry_changed_cb (GtkWidget *entry, NautilusQueryEditor *editor) { + g_clear_handle_id (&editor->search_changed_timeout_id, g_source_remove); + if (editor->change_frozen) { return; } - g_clear_handle_id (&editor->search_changed_timeout_id, g_source_remove); editor->search_changed_timeout_id = g_timeout_add (SEARCH_CHANGED_TIMEOUT, G_SOURCE_FUNC (entry_changed_internal), editor); |