[Bug 72138] Incorrect error handling
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Fri Nov 29 04:54:02 PST 2013
https://bugs.freedesktop.org/show_bug.cgi?id=72138
--- Comment #2 from Simon McVittie <simon.mcvittie at collabora.co.uk> ---
(In reply to comment #1)
> You should use g_clear_error() instead
I agree...
> I'm actually tempted to do a big s/g_error_free/g_clear_error/
... but I think this is going too far - it's often obvious that the error is
both non-NULL and no longer used, for instance in this idiom for dealing with
errors that there's no way to signal (yes that's a design flaw, but often one
that we're stuck with medium-term):
static void
foo (void)
{
GError *error = NULL;
if (do_a_thing (&error))
{
WARNING ("%s", error->message);
g_error_free (error);
}
}
or when interacting with dbus-glib:
static void
do_something_on_dbus (DBusGMethodInvocation *context)
{
GError *error = NULL;
if (do_something (&error))
{
dbus_g_method_return (context);
}
else
{
dbus_g_method_return_error (context, error);
g_error_free (error);
}
}
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
More information about the telepathy-bugs
mailing list