summaryrefslogtreecommitdiffstats
path: root/meta/packages/dbus/dbus/0.23.1.diff
blob: d56e1afc9c0f06ebdf44b24ffdde53c9ec983e6f (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
diff -ur dbus-0.23/ChangeLog dbus-0.23.1/ChangeLog
--- dbus-0.23/ChangeLog	2005-01-13 00:48:43.000000000 +0200
+++ dbus-0.23.1/ChangeLog	2005-02-11 20:25:48.000000000 +0200
@@ -1,3 +1,33 @@
+2005-02-11  Joe Shaw  <joeshaw@novell.com>
+
+	* NEWS: Update for 0.23.1
+
+	* configure.in: Release 0.23.1
+
+2005-02-10  Joe Shaw  <joeshaw@novell.com>
+
+	* dbus/dbus-connection.c
+	(_dbus_connection_queue_received_message_link,
+	_dbus_connection_message_sent): Add the path to
+	the verbose output.
+	(_dbus_connection_send_preallocated_and_unlock): Added.  Calls
+	_dbus_connection_send_preallocated_unlocked(), updated the
+	dispatch status, and unlocks.  Fixes a bug where certain
+	situations (like a broken pipe) could cause a Disconnect message
+	to not be sent, tricking the bus into thinking a service was still
+	there when the process had quit.
+	(_dbus_connection_send_preallocated): Call
+	_dbus_connection_send_preallocated_and_unlock().
+	(_dbus_connection_send_and_unlock): Added.  Calls
+	_dbus_connection_send_preallocated_and_unlock().
+	(dbus_connection_send): Call _dbus_connection_send_and_unlock().
+	(dbus_connection_send_with_reply): Update the dispatch status and
+	unlock.
+
+	* mono/Service.cs (~Service): Added.  Removes the filter so that
+	we don't get unmanaged code calling back into a GCed delegate.
+	(RemoveFilter); Added.
+
 2005-01-12  Joe Shaw  <joeshaw@novell.com>
 
 	* NEWS: Update for 0.23.
diff -ur dbus-0.23/NEWS dbus-0.23.1/NEWS
--- dbus-0.23/NEWS	2005-01-13 00:20:40.000000000 +0200
+++ dbus-0.23.1/NEWS	2005-02-11 20:25:16.000000000 +0200
@@ -1,3 +1,11 @@
+D-BUS 0.23.1 (11 Feb 2005)
+===
+- fix a bug in which the bus daemon wouldn't recognize that a service
+  owner quit
+- fix a bug in the mono bindings that would cause unmanaged code to
+  call back into a delegate that had been garbage collected and
+  crashed.
+
 D-BUS 0.23 (11 Jan 2005)
 ===
 
diff -ur dbus-0.23/configure dbus-0.23.1/configure
--- dbus-0.23/configure	2005-01-13 00:21:25.000000000 +0200
+++ dbus-0.23.1/configure	2005-02-11 19:53:33.000000000 +0200
@@ -1826,7 +1826,7 @@
 
 # Define the identity of the package.
  PACKAGE=dbus
- VERSION=0.23
+ VERSION=0.23.1
 
 
 cat >>confdefs.h <<_ACEOF
diff -ur dbus-0.23/configure.in dbus-0.23.1/configure.in
--- dbus-0.23/configure.in	2005-01-13 00:20:40.000000000 +0200
+++ dbus-0.23.1/configure.in	2005-02-11 19:53:09.000000000 +0200
@@ -3,7 +3,7 @@
 
 AC_INIT(dbus/dbus.h)
 
-AM_INIT_AUTOMAKE(dbus, 0.23)
+AM_INIT_AUTOMAKE(dbus, 0.23.1)
 
 AM_CONFIG_HEADER(config.h)
 
diff -ur dbus-0.23/dbus/dbus-connection.c dbus-0.23.1/dbus/dbus-connection.c
--- dbus-0.23/dbus/dbus-connection.c	2005-01-11 21:31:56.000000000 +0200
+++ dbus-0.23.1/dbus/dbus-connection.c	2005-02-11 19:52:47.000000000 +0200
@@ -358,9 +358,10 @@
 
   _dbus_connection_wakeup_mainloop (connection);
   
-  _dbus_verbose ("Message %p (%d %s %s '%s') added to incoming queue %p, %d incoming\n",
+  _dbus_verbose ("Message %p (%d %s %s %s '%s') added to incoming queue %p, %d incoming\n",
                  message,
                  dbus_message_get_type (message),
+		 dbus_message_get_path (message),
                  dbus_message_get_interface (message) ?
                  dbus_message_get_interface (message) :
                  "no interface",
@@ -473,9 +474,10 @@
   
   connection->n_outgoing -= 1;
 
-  _dbus_verbose ("Message %p (%d %s %s '%s') removed from outgoing queue %p, %d left to send\n",
+  _dbus_verbose ("Message %p (%d %s %s %s '%s') removed from outgoing queue %p, %d left to send\n",
                  message,
                  dbus_message_get_type (message),
+		 dbus_message_get_path (message),
                  dbus_message_get_interface (message) ?
                  dbus_message_get_interface (message) :
                  "no interface",
@@ -1572,9 +1574,10 @@
   }
 #endif
   
-  _dbus_verbose ("Message %p (%d %s %s '%s') added to outgoing queue %p, %d pending to send\n",
+  _dbus_verbose ("Message %p (%d %s %s %s '%s') added to outgoing queue %p, %d pending to send\n",
                  message,
                  dbus_message_get_type (message),
+		 dbus_message_get_path (message),
                  dbus_message_get_interface (message) ?
                  dbus_message_get_interface (message) :
                  "no interface",
@@ -1606,12 +1609,30 @@
   _dbus_connection_do_iteration (connection,
                                  DBUS_ITERATION_DO_WRITING,
                                  -1);
-  
+
   /* If stuff is still queued up, be sure we wake up the main loop */
   if (connection->n_outgoing > 0)
     _dbus_connection_wakeup_mainloop (connection);
 }
 
+static void
+_dbus_connection_send_preallocated_and_unlock (DBusConnection       *connection,
+					       DBusPreallocatedSend *preallocated,
+					       DBusMessage          *message,
+					       dbus_uint32_t        *client_serial)
+{
+  DBusDispatchStatus status;
+
+  _dbus_connection_send_preallocated_unlocked (connection,
+                                               preallocated,
+                                               message, client_serial);
+
+  status = _dbus_connection_get_dispatch_status_unlocked (connection);
+
+  /* this calls out to user code */
+  _dbus_connection_update_dispatch_status_and_unlock (connection, status);
+}
+
 /**
  * Sends a message using preallocated resources. This function cannot fail.
  * It works identically to dbus_connection_send() in other respects.
@@ -1642,10 +1663,9 @@
                          dbus_message_get_member (message) != NULL));
   
   CONNECTION_LOCK (connection);
-  _dbus_connection_send_preallocated_unlocked (connection,
-                                               preallocated,
-                                               message, client_serial);
-  CONNECTION_UNLOCK (connection);  
+  _dbus_connection_send_preallocated_and_unlock (connection,
+						 preallocated,
+						 message, client_serial);
 }
 
 static dbus_bool_t
@@ -1670,6 +1690,27 @@
   return TRUE;
 }
 
+static dbus_bool_t
+_dbus_connection_send_and_unlock (DBusConnection *connection,
+				  DBusMessage    *message,
+				  dbus_uint32_t  *client_serial)
+{
+  DBusPreallocatedSend *preallocated;
+
+  _dbus_assert (connection != NULL);
+  _dbus_assert (message != NULL);
+  
+  preallocated = _dbus_connection_preallocate_send_unlocked (connection);
+  if (preallocated == NULL)
+    return FALSE;
+
+  _dbus_connection_send_preallocated_and_unlock (connection,
+						 preallocated,
+						 message,
+						 client_serial);
+  return TRUE;
+}
+
 /**
  * Adds a message to the outgoing message queue. Does not block to
  * write the message to the network; that happens asynchronously. To
@@ -1698,14 +1739,9 @@
 
   CONNECTION_LOCK (connection);
 
-  if (!_dbus_connection_send_unlocked (connection, message, client_serial))
-    {
-      CONNECTION_UNLOCK (connection);
-      return FALSE;
-    }
-
-  CONNECTION_UNLOCK (connection);
-  return TRUE;
+  return _dbus_connection_send_and_unlock (connection,
+					   message,
+					   client_serial);
 }
 
 static dbus_bool_t
@@ -1784,6 +1820,7 @@
   DBusMessage *reply;
   DBusList *reply_link;
   dbus_int32_t serial = -1;
+  DBusDispatchStatus status;
 
   _dbus_return_val_if_fail (connection != NULL, FALSE);
   _dbus_return_val_if_fail (message != NULL, FALSE);
@@ -1845,8 +1882,11 @@
   else
     dbus_pending_call_unref (pending);
 
-  CONNECTION_UNLOCK (connection);
-  
+  status = _dbus_connection_get_dispatch_status_unlocked (connection);
+
+  /* this calls out to user code */
+  _dbus_connection_update_dispatch_status_and_unlock (connection, status);
+
   return TRUE;
 
  error:
@@ -2256,9 +2296,10 @@
       link = _dbus_list_pop_first_link (&connection->incoming_messages);
       connection->n_incoming -= 1;
 
-      _dbus_verbose ("Message %p (%d %s %s '%s') removed from incoming queue %p, %d incoming\n",
+      _dbus_verbose ("Message %p (%d %s %s %s '%s') removed from incoming queue %p, %d incoming\n",
                      link->data,
                      dbus_message_get_type (link->data),
+		     dbus_message_get_path (link->data), 
                      dbus_message_get_interface (link->data) ?
                      dbus_message_get_interface (link->data) :
                      "no interface",
diff -ur dbus-0.23/mono/Service.cs dbus-0.23.1/mono/Service.cs
--- dbus-0.23/mono/Service.cs	2004-08-31 06:59:14.000000000 +0300
+++ dbus-0.23.1/mono/Service.cs	2005-02-11 19:52:47.000000000 +0200
@@ -23,6 +23,9 @@
     private static AssemblyBuilder proxyAssembly;
     private ModuleBuilder module = null;
 
+    // Add a match for signals. FIXME: Can we filter the service?
+    private const string MatchRule = "type='signal'";
+
     internal Service(string name, Connection connection)
     {
       this.name = name;
@@ -47,6 +50,12 @@
       this.local = true;
     }
 
+    ~Service ()
+    {
+      if (this.filterCalled != null)
+        RemoveFilter ();
+    }
+
     public static bool Exists(Connection connection, string name)
     {
       Error error = new Error();
@@ -113,9 +122,17 @@
 				      IntPtr.Zero))
 	throw new OutOfMemoryException();
 
-      // Add a match for signals. FIXME: Can we filter the service?
-      string rule = "type='signal'";
-      dbus_bus_add_match(connection.RawConnection, rule, IntPtr.Zero);
+      dbus_bus_add_match(connection.RawConnection, MatchRule, IntPtr.Zero);
+    }
+
+    private void RemoveFilter()
+    {
+      dbus_connection_remove_filter (Connection.RawConnection,
+                                    this.filterCalled,
+                                    IntPtr.Zero);
+      this.filterCalled = null;
+
+      dbus_bus_remove_match (connection.RawConnection, MatchRule, IntPtr.Zero);
     }
 
     private int Service_FilterCalled(IntPtr rawConnection,
@@ -200,9 +217,19 @@
 							  IntPtr freeData);
 
     [DllImport("dbus-1")]
+    private extern static void dbus_connection_remove_filter(IntPtr rawConnection,
+							     DBusHandleMessageFunction filter,
+							     IntPtr userData);
+
+    [DllImport("dbus-1")]
     private extern static void dbus_bus_add_match(IntPtr rawConnection,
 						  string rule,
 						  IntPtr erro);
 
+    [DllImport("dbus-1")]
+    private extern static void dbus_bus_remove_match(IntPtr rawConnection,
+						     string rule,
+						     IntPtr erro);
+
   }
 }