[gnome-shell/gnome-3-30] StTextureCache: use right event to detect file changes
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-30] StTextureCache: use right event to detect file changes
- Date: Sat, 10 Nov 2018 01:09:12 +0000 (UTC)
commit 609c81698e1c45771cc435c4b745314409d58493
Author: Cosimo Cecchi <cosimo endlessm com>
Date: Fri Nov 9 21:55:53 2018 +0000
StTextureCache: use right event to detect file changes
StTextureCache installs file monitors that invalidate caches when
contents of the underlying file change.
At the moment, the cache uses the Gio.FileMonitorEvent.CHANGED event
type to make that determination.
However, that is suboptimal for at least two reasons:
- while a file is being written to disk, many CHANGED events will be
emitted in sequence. That will cause needless cache invalidations,
and we will risk loading the file before it's fully loaded.
- if an existing file is replaced, e.g. with g_file_replace(), we may
not get a CHANGED event but a CREATED one instead, so the cache ends
up never getting invalidated.
The good news is that in both of those cases GFileMonitor will send a
CHANGES_DONE_HINT event after changes have settled, or after the file
is replaced.
This commit fixes both cases by switching from the CHANGED event to
CHANGES_DONE_HINT to determine that a file has in fact changed.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/286
(cherry picked from commit ca3f4cfb41851fec84a68fc334bef2e3e9a552bc)
src/st/st-texture-cache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c
index 3bf3a5e97..621907111 100644
--- a/src/st/st-texture-cache.c
+++ b/src/st/st-texture-cache.c
@@ -984,7 +984,7 @@ file_changed_cb (GFileMonitor *monitor,
char *key;
guint file_hash;
- if (event_type != G_FILE_MONITOR_EVENT_CHANGED)
+ if (event_type != G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT)
return;
file_hash = g_file_hash (file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]