GNOME Bugzilla – Bug 360224
Fix an issue with error handling
Last modified: 2007-01-25 13:30:01 UTC
I was seeing a crash in some gconf-using application where gconf_client_get_schema() apparently returned NULL without setting error. This lead me to look at gconf-client.c and I think there are several getters which have the same problem. They pass err to the gconf_client_get() call, but later in the else branch, they check if error != NULL. The patch changes this to pass the local error to gconf_client_geT (). That also makes the assert in the if branch meaningful.
Created attachment 74165 [details] [review] patch
2006-10-07 Matthias Clasen <mclasen@redhat.com> * gconf/gconf-client.c: Fix error handling in the getters. (#102050, #360224)
This change doesn't look right to me, now we pass a GError * but it should really be GError **, i.e. &error.
I'm reopening this so it's not forgotten. An example to make it more clear what's wrong, this is an example from the current code: gdouble gconf_client_get_float (GConfClient* client, const gchar* key, GError** err) { static const gdouble def = 0.0; GError* error = NULL; GConfValue *val; g_return_val_if_fail (err == NULL || *err == NULL, 0.0); val = gconf_client_get (client, key, error); Which is clearly wrong, should be &error, and similarly in the other places.
sure, it should be &error, you are correct
Created attachment 81184 [details] [review] patch to fix up stuff again Commiting this then to fix it up again.