On Wed, 2010-01-27 at 15:06 +0000, Bastien Nocera wrote:
> On Wed, 2010-01-27 at 09:44 -0500, Pierre-Luc Beaudoin wrote:
> > On Wed, 2010-01-27 at 14:15 +0000, Bastien Nocera wrote:
> > > Opinions? 
> > 
> > I believe it would be nicer to use glib-mkenums to generate
> > geoclue_error_get_type dynamically.
> > 
> > This is how I did it in libchamplain:
> > http://git.gnome.org/browse/libchamplain/commit/?id=00a10b88ccbf3f5eb9e1de8c82a18eb70598830e
> > 
> > I don't see anything else wrong with your patch.
> 
> Done.

And another patch that should actually fix the bug.
>From 3410cc39f533ebf81a49d9a72ebbf3c38429369c Mon Sep 17 00:00:00 2001
From: Bastien Nocera <[email protected]>
Date: Thu, 28 Jan 2010 11:17:24 +0000
Subject: [PATCH] Don't lose special D-Bus error sauce when copying

When copying errors for later use, make sure to copy D-Bus
errors special sauce (domain name of the error copied after the
string itself).

With help from Matthias Clasen
---
 src/master-provider.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/master-provider.c b/src/master-provider.c
index c54919a..dd49ee7 100644
--- a/src/master-provider.c
+++ b/src/master-provider.c
@@ -126,6 +126,19 @@ copy_error (GError **target, GError *source)
 	}
 	if (source) {
 		*target = g_error_copy (source);
+
+		/* If the error type is a D-Bus remote exception,
+		 * don't lose the "magic" sauce after the message string.
+		 * See the code in gerror_to_dbus_error_message() in dbus-glib */
+		if (source->domain == DBUS_GERROR &&
+		    source->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+			int len;
+			g_free ((*target)->message);
+			len = strlen (source->message);
+			len += strlen (source->message + len + 1);
+			len += 2;
+			(*target)->message = g_memdup (source->message, len);
+		}
 	}
 }
 
-- 
1.6.6

_______________________________________________
GeoClue mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/geoclue

Reply via email to