38 lines
1.3 KiB
Diff
38 lines
1.3 KiB
Diff
|
|
From 6336864171d0d14297de5af2aba0a5de00a8d257 Mon Sep 17 00:00:00 2001
|
||
|
|
From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= <tomasz.miasko@gmail.com>
|
||
|
|
Date: Fri, 22 Feb 2019 00:00:00 +0000
|
||
|
|
Subject: [PATCH 628/682] glocalfilemonitor: Fix data race in local file
|
||
|
|
monitor
|
||
|
|
|
||
|
|
Ensure that source is attached to the context before it migth be used
|
||
|
|
from another thread, since otherwise operation on source are
|
||
|
|
unsynchronized and not thread-safe.
|
||
|
|
|
||
|
|
In particular there was a data race between g_source_attach and
|
||
|
|
g_source_set_ready_time (used from g_file_monitor_source_handle_event).
|
||
|
|
---
|
||
|
|
gio/glocalfilemonitor.c | 4 ++--
|
||
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/gio/glocalfilemonitor.c b/gio/glocalfilemonitor.c
|
||
|
|
index 8a4c4ec43..278d9a492 100644
|
||
|
|
--- a/gio/glocalfilemonitor.c
|
||
|
|
+++ b/gio/glocalfilemonitor.c
|
||
|
|
@@ -788,11 +788,11 @@ g_local_file_monitor_start (GLocalFileMonitor *local_monitor,
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
|
||
|
|
+ g_source_attach ((GSource *) source, context);
|
||
|
|
+
|
||
|
|
G_LOCAL_FILE_MONITOR_GET_CLASS (local_monitor)->start (local_monitor,
|
||
|
|
source->dirname, source->basename, source->filename,
|
||
|
|
source);
|
||
|
|
-
|
||
|
|
- g_source_attach ((GSource *) source, context);
|
||
|
|
}
|
||
|
|
|
||
|
|
static void
|
||
|
|
--
|
||
|
|
2.19.1
|
||
|
|
|