After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 360224 - Fix an issue with error handling
Fix an issue with error handling
Status: RESOLVED FIXED
Product: GConf
Classification: Deprecated
Component: gconf
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GConf Maintainers
GConf Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-10-06 17:23 UTC by Matthias Clasen
Modified: 2007-01-25 13:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (1.58 KB, patch)
2006-10-06 17:25 UTC, Matthias Clasen
committed Details | Review
patch to fix up stuff again (1.91 KB, patch)
2007-01-25 13:24 UTC, Kjartan Maraas
none Details | Review

Description Matthias Clasen 2006-10-06 17:23:09 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.
Comment 1 Matthias Clasen 2006-10-06 17:25:47 UTC
Created attachment 74165 [details] [review]
patch
Comment 2 Matthias Clasen 2006-10-07 23:36:56 UTC
2006-10-07  Matthias Clasen <mclasen@redhat.com>

        * gconf/gconf-client.c: Fix error handling in the
        getters.  (#102050, #360224)

Comment 3 Richard Hult 2006-11-14 10:57:07 UTC
This change doesn't look right to me, now we pass a GError * but it should really be GError **, i.e. &error.
Comment 4 Richard Hult 2007-01-17 13:56:30 UTC
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.
Comment 5 Matthias Clasen 2007-01-24 16:28:59 UTC
sure, it should be &error, you are correct
Comment 6 Kjartan Maraas 2007-01-25 13:24:53 UTC
Created attachment 81184 [details] [review]
patch to fix up stuff again

Commiting this then to fix it up again.