~ubuntu-branches/debian/squeeze/glib2.0/squeeze

« back to all changes in this revision

Viewing changes to debian/patches/90_from_svn_fix_cancellation_issue.patch

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-03-05 18:16:09 UTC
  • Revision ID: james.westby@ubuntu.com-20080305181609-9i5qyyisrpc9x7tv
Tags: 2.15.6-0ubuntu3
* debian/patches/90_from_svn_fix_cancellation_issue.patch:
  - change from SVN, fix gvfsd-trash crashers (lp: #186460, #197444)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--- trunk/gio/gfilemonitor.c    2008/03/05 11:40:12     6629
 
2
+++ trunk/gio/gfilemonitor.c    2008/03/05 11:50:27     6630
 
3
@@ -45,6 +45,8 @@
 
4
  * are monitoring, connect to the #GFileMonitor::changed signal.
 
5
  **/
 
6
 
 
7
+G_LOCK_DEFINE_STATIC(cancelled);
 
8
+
 
9
 enum {
 
10
   CHANGED,
 
11
   LAST_SIGNAL
 
12
@@ -117,7 +119,9 @@
 
13
       break;
 
14
 
 
15
     case PROP_CANCELLED:
 
16
+      G_LOCK (cancelled);
 
17
       g_value_set_boolean (value, priv->cancelled);
 
18
+      G_UNLOCK (cancelled);
 
19
       break;
 
20
 
 
21
     default:
 
22
@@ -165,8 +169,7 @@
 
23
   monitor = G_FILE_MONITOR (object);
 
24
 
 
25
   /* Make sure we cancel on last unref */
 
26
-  if (!monitor->priv->cancelled)
 
27
-    g_file_monitor_cancel (monitor);
 
28
+  g_file_monitor_cancel (monitor);
 
29
   
 
30
   if (G_OBJECT_CLASS (g_file_monitor_parent_class)->dispose)
 
31
     (*G_OBJECT_CLASS (g_file_monitor_parent_class)->dispose) (object);
 
32
@@ -247,8 +250,13 @@
 
33
 g_file_monitor_is_cancelled (GFileMonitor *monitor)
 
34
 {
 
35
   g_return_val_if_fail (G_IS_FILE_MONITOR (monitor), FALSE);
 
36
+  gboolean res;
 
37
 
 
38
-  return monitor->priv->cancelled;
 
39
+  G_LOCK (cancelled);
 
40
+  res = monitor->priv->cancelled;
 
41
+  G_UNLOCK (cancelled);
 
42
+  
 
43
+  return res;
 
44
 }
 
45
 
 
46
 /**
 
47
@@ -266,10 +274,16 @@
 
48
   
 
49
   g_return_val_if_fail (G_IS_FILE_MONITOR (monitor), FALSE);
 
50
   
 
51
+  G_LOCK (cancelled);
 
52
   if (monitor->priv->cancelled)
 
53
-    return TRUE;
 
54
+    {
 
55
+      G_UNLOCK (cancelled);
 
56
+      return TRUE;
 
57
+    }
 
58
   
 
59
   monitor->priv->cancelled = TRUE;
 
60
+  G_UNLOCK (cancelled);
 
61
+  
 
62
   g_object_notify (G_OBJECT (monitor), "cancelled");
 
63
 
 
64
   klass = G_FILE_MONITOR_GET_CLASS (monitor);
 
65
--- trunk/gio/glocaldirectorymonitor.c  2008/03/05 11:40:12     6629
 
66
+++ trunk/gio/glocaldirectorymonitor.c  2008/03/05 11:50:27     6630
 
67
@@ -128,8 +128,8 @@
 
68
         g_unix_mount_free (mount);
 
69
 
 
70
       local_monitor->mount_monitor = g_unix_mount_monitor_new ();
 
71
-      g_signal_connect (local_monitor->mount_monitor, "mounts_changed",
 
72
-        G_CALLBACK (mounts_changed), local_monitor);
 
73
+      g_signal_connect_object (local_monitor->mount_monitor, "mounts_changed",
 
74
+                              G_CALLBACK (mounts_changed), local_monitor, 0);
 
75
 #endif
 
76
     }
 
77