Package: gvfs / 1.30.4-1

ref-jobs-in-thread.patch Patch series | download
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Description: make sure to keep a ref to jobs while they run in a thread
Origin: vendor, Ubuntu

--- a/daemon/gvfsdaemon.c
+++ b/daemon/gvfsdaemon.c
@@ -206,6 +206,7 @@
   GVfsJob *job = G_VFS_JOB (data);
 
   g_vfs_job_run (job);
+  g_object_unref (job);
 }
 
 static void
@@ -599,7 +600,8 @@
   if (!g_vfs_job_try (job))
     {
       /* Couldn't finish / run async, queue worker thread */
-      g_thread_pool_push (daemon->thread_pool, job, NULL); /* TODO: Check error */
+      if (!g_thread_pool_push (daemon->thread_pool, g_object_ref (job), NULL)) /* TODO: Check error */
+        g_object_unref (job);
     }
 }
 
@@ -1115,7 +1117,8 @@
 g_vfs_daemon_run_job_in_thread (GVfsDaemon *daemon,
 				GVfsJob    *job)
 {
-  g_thread_pool_push (daemon->thread_pool, job, NULL); /* TODO: Check error */
+  if (!g_thread_pool_push (daemon->thread_pool, g_object_ref (job), NULL)) /* TODO: Check error */
+    g_object_unref (job);
 }
 
 void
--- a/daemon/gvfschannel.c
+++ b/daemon/gvfschannel.c
@@ -643,6 +643,7 @@
     }
 
   g_object_unref (job);
+  g_object_unref (channel);
 }
 
 /* Might be called on an i/o thread */
@@ -666,7 +667,7 @@
 				   channel->priv->reply_buffer,
 				   G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_SIZE,
 				   0, NULL,
-				   send_reply_cb, channel);  
+				   send_reply_cb, g_object_ref (channel));  
     }
   else
     {
@@ -675,7 +676,7 @@
 				   channel->priv->output_data,
 				   channel->priv->output_data_size,
 				   0, NULL,
-				   send_reply_cb, channel);  
+				   send_reply_cb, g_object_ref (channel));  
     }
 }