[Pkg-utopia-maintainers] Bug#541632: libdbus-glib-1-2: wonky results from dbus_g_proxy_call

Andres Salomon dilinger at collabora.co.uk
Sat Aug 15 00:27:34 UTC 2009


Package: libdbus-glib-1-2
Version: 0.82-1

I have the following bit of code:

  ofono = dbus_g_proxy_new_for_name (dbus,
      "org.ofono", "/", "org.ofono.at.Manager");
  if (!dbus_g_proxy_call (ofono, "Create", &e,
      G_TYPE_STRING, priv->device, G_TYPE_STRING, "at", G_TYPE_INVALID,
//      DBUS_TYPE_G_PROXY, &priv->modem, G_TYPE_INVALID))
      G_TYPE_STRING, &m, G_TYPE_INVALID))

Now, it turns out that the signature for this method is:

Create(s,s) -> (o)

Clearly, this (client) code is wrong; dbus_g_proxy_call returns FALSE,
as it should.  However, 'e' remains NULL.  The reasons for this is
interesting..

The method is called, and dbus_g_proxy_end_call_internal is called to
handle the result. It calls _dbus_gvalue_demarshal, which returns FALSE
but doesn't set any errors.  _dbus_gvalue_demarshal is calling
the demarshaller callback, which actually calls demarshal_basic.
demarshal_basic has a large switch() statement, which looks at the
type.  The type is ((int)'o')  (ie, DBUS_TYPE_OBJECT_PATH); this
doesn't match against anything in the switch statement, so the
'default' block is run.

    default:
      g_assert_not_reached ();
      return FALSE;
    }

Thus, 'error' is never set, and an assertion that's never supposed to
be reached is reached.  It should probably just 'goto invalid_type;' or
something..







More information about the Pkg-utopia-maintainers mailing list