glib bindings crash with many out params

Jonathan Matthew jonathan at kaolin.hn.org
Sun Apr 24 17:46:33 PDT 2005


On Mon, Apr 25, 2005 at 10:20:34AM +1000, Jonathan Matthew wrote:

> The trivial fix is to make the array big enough before adding anything to
> it.  Patch attached.

How about I try that again, only not backwards this time..

--- dbus-0.32-orig/glib/dbus-gobject.c  2005-04-25 10:03:23.000000000 +1000
+++ dbus-0.32/glib/dbus-gobject.c       2005-04-25 10:04:36.000000000 +1000
@@ -802,7 +802,7 @@
    * to each of those values, and append to the invocation,
    * so the method can return the OUT parameters.
    */
-  out_param_values = g_array_new (FALSE, TRUE, sizeof (DBusBasicGValue));
+  out_param_values = g_array_sized_new (FALSE, TRUE, sizeof (DBusBasicGValue), out_signature_len);
   for (i = 0; i < out_signature_len; i++)
     {
       GValue value = {0, };



More information about the dbus mailing list