[gvfs/gnome-3-26] daemon: Add missing guards for job_sources
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/gnome-3-26] daemon: Add missing guards for job_sources
- Date: Wed, 28 Feb 2018 08:51:14 +0000 (UTC)
commit 44ae775dfcdad92a89db8e86b7cec1415863723d
Author: Ondrej Holy <oholy redhat com>
Date: Fri Feb 16 10:22:57 2018 +0100
daemon: Add missing guards for job_sources
Use daemon->lock when accessing daemon->job_sources as on other places.
This might potentially help to fix some segfaults.
https://bugzilla.gnome.org/show_bug.cgi?id=787992
daemon/gvfsdaemon.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/daemon/gvfsdaemon.c b/daemon/gvfsdaemon.c
index b7a3b88..8305700 100644
--- a/daemon/gvfsdaemon.c
+++ b/daemon/gvfsdaemon.c
@@ -1069,6 +1069,8 @@ g_vfs_daemon_get_blocking_processes (GVfsDaemon *daemon)
GArray *processes;
GList *l;
+ g_mutex_lock (&daemon->lock);
+
processes = g_array_new (FALSE, FALSE, sizeof (GPid));
for (l = daemon->job_sources; l != NULL; l = l->next)
{
@@ -1080,6 +1082,8 @@ g_vfs_daemon_get_blocking_processes (GVfsDaemon *daemon)
}
}
+ g_mutex_unlock (&daemon->lock);
+
return processes;
}
@@ -1124,8 +1128,12 @@ g_vfs_daemon_close_active_channels (GVfsDaemon *daemon,
{
GList *l;
- for (l = daemon->job_sources; l != NULL; l = l->next)
- if (G_VFS_IS_CHANNEL (l->data) &&
- g_vfs_channel_get_backend (G_VFS_CHANNEL (l->data)) == backend)
- g_vfs_channel_force_close (G_VFS_CHANNEL (l->data));
+ g_mutex_lock (&daemon->lock);
+
+ for (l = daemon->job_sources; l != NULL; l = l->next)
+ if (G_VFS_IS_CHANNEL (l->data) &&
+ g_vfs_channel_get_backend (G_VFS_CHANNEL (l->data)) == backend)
+ g_vfs_channel_force_close (G_VFS_CHANNEL (l->data));
+
+ g_mutex_unlock (&daemon->lock);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]