Re: [patch] constify g_simple_async_result_set_from_error



David Zeuthen wrote:
On Wed, 2009-09-02 at 19:17 +0100, Richard Hughes wrote:
In PackageKit, I have to explicitly cast in my finish function:

static void
pk_package_sack_merge_state_finish (PkPackageSackState *state, const
GError *error)
{
...
		g_simple_async_result_set_from_error (state->res, (GError*) error);
...
}

The finish function is passed a const GError (as the error can't be
freed), hence the cast is required for the compiler not to warn.

Of course, the correct thing to do would be to trivially fix gio, and
a patch is attached that does exactly that. Okay to commit?

Mmmm, wouldn't this break the API? E.g. cause compilation of existing
apps to spew warnings. If so, we can't do it.

There is no problem providing a non-const value to a function which expects a const one, hence the previously working code should behave just fine.

Unfortunately there's a lot of const incorrectness in the GLib and GTK+
stack - maybe we should fix this in GLib3/GTK3 since it's going to be a
new ABI.

+1, but I don't think it would make the ABI change...


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]