Bug 16776

Summary: [fixed in git] dbus_g_method_return_error should accept all DBUS_GERROR_*
Product: dbus Reporter: Simon McVittie <smcv>
Component: GLibAssignee: Rob Taylor <rob.taylor>
Status: RESOLVED FIXED QA Contact: John (J5) Palmieri <johnp>
Severity: enhancement    
Priority: medium CC: walters
Version: unspecifiedKeywords: patch
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Two git-am patches (implementation and regression test)

Description Simon McVittie 2008-07-18 10:14:02 UTC
While writing the D-Bus Properties mixin for telepathy-glib, I wanted to raise org.freedesktop.DBus.Error.InvalidArgs, and assumed that this would work:

  if (prop_impl == NULL)
    {
      GError e = { DBUS_GERROR, DBUS_GERROR_INVALID_ARGS,
          "Unknown property" };

      dbus_g_method_return_error (context, &e);
      return;
    }

Unfortunately, dbus_g_method_return_error will assert in this case - it assumes that (error->domain == DBUS_GERROR) implies (error->code == DBUS_GERROR_REMOTE_EXCEPTION), which is untrue.
Comment 1 Simon McVittie 2008-11-28 09:27:56 UTC
Created attachment 20672 [details] [review]
Two git-am patches (implementation and regression test)

Also available from:
http://git.collabora.co.uk/?p=user/smcv/dbus-glib-smcv.git;a=shortlog;h=refs/heads/16776
git://git.collabora.co.uk/git/user/smcv/dbus-glib-smcv.git
Comment 2 Simon McVittie 2009-03-26 11:16:19 UTC
I've rebased this patch on current git master. Could someone review, please?

http://git.collabora.co.uk/?p=user/smcv/dbus-glib-smcv.git;a=shortlog;h=refs/heads/16776
Comment 3 Simon McVittie 2009-04-15 13:17:22 UTC
Colin, any chance you could have a look at this?
Comment 4 Simon McVittie 2009-04-27 02:43:15 UTC
The git-am patches above should still be applicable. Also available in gitweb at:

http://git.collabora.co.uk/?p=user/smcv/dbus-glib-smcv.git;a=shortlog;h=refs/heads/16776-make-dbus-errors-throwable

This patch can be pulled from:

git://git.collabora.co.uk/git/user/smcv/dbus-glib-smcv.git 16776-make-dbus-errors-throwable.
Comment 5 Colin Walters 2009-05-06 10:56:09 UTC
Looks OK to me.  Unfortunate we need to have the reverse dbus/gerror mapping but it seems relatively unavoidable.

Please commit.
Comment 6 Simon McVittie 2009-05-07 07:34:26 UTC
Pushed, thanks.
Comment 7 Simon McVittie 2009-07-20 05:59:33 UTC
Fixed in 0.82, according to Colin's release mail.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.