[gvfs] daemon: Add missing guards for job_sources
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] daemon: Add missing guards for job_sources
- Date: Mon, 19 Feb 2018 12:26:01 +0000 (UTC)
commit e147e48f91c208aa2517b52a9dfeb62daa4ffb26
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 69e5687..09336ec 100644
--- a/daemon/gvfsdaemon.c
+++ b/daemon/gvfsdaemon.c
@@ -1067,6 +1067,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)
{
@@ -1078,6 +1080,8 @@ g_vfs_daemon_get_blocking_processes (GVfsDaemon *daemon)
}
}
+ g_mutex_unlock (&daemon->lock);
+
return processes;
}
@@ -1122,8 +1126,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]