summaryrefslogtreecommitdiff
path: root/patches/source/glib2/glib.bug.758823.diff
blob: e92c03687bd8f28b32edf87e37809e520b3a2286 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From 30359e740953b596d6c3d980dba36dd131681a1f Mon Sep 17 00:00:00 2001
From: Allison Ryan Lortie <desrt@desrt.ca>
Date: Mon, 30 Nov 2015 10:13:46 -0500
Subject: file monitors: reorder some code to avoid segfault

We must initialise '->source' before we use fields inside of it.

https://bugzilla.gnome.org/show_bug.cgi?id=758823
---
 gio/glocalfilemonitor.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gio/glocalfilemonitor.c b/gio/glocalfilemonitor.c
index dbd62ec..49a4dd2 100644
--- a/gio/glocalfilemonitor.c
+++ b/gio/glocalfilemonitor.c
@@ -748,6 +748,9 @@ g_local_file_monitor_start (GLocalFileMonitor *local_monitor,
 
   g_assert (!local_monitor->source);
 
+  source = g_file_monitor_source_new (local_monitor, filename, is_directory, flags);
+  local_monitor->source = source; /* owns the ref */
+
   if (is_directory && !class->mount_notify && (flags & G_FILE_MONITOR_WATCH_MOUNTS))
     {
 #ifdef G_OS_WIN32
@@ -771,9 +774,6 @@ g_local_file_monitor_start (GLocalFileMonitor *local_monitor,
 #endif
     }
 
-  source = g_file_monitor_source_new (local_monitor, filename, is_directory, flags);
-  local_monitor->source = source; /* owns the ref */
-
   G_LOCAL_FILE_MONITOR_GET_CLASS (local_monitor)->start (local_monitor,
                                                          source->dirname, source->basename, source->filename,
                                                          source);
-- 
cgit v0.12