[PATCH] fix: list partially corrupted folder

Jonas Kümmerlin rgcjonas at gmail.com
Mon Aug 31 23:08:18 CEST 2015

Am Sonntag, den 30.08.2015, 18:44 +0200 schrieb Jean-Tiare Le Bigot:
>    if (err != NULL)
>      {
>        g_propagate_error (error, err);
> -      return FALSE;
> +      g_clear_error(&err);
Do NOT ever do anything with err after you propagated it with
g_propagate_error(); g_propagate_error() invalidates the source. The only thing
you may (and have to if you plan to use the variable after that) do is simply
set err = NULL. (Hint: The docs explicitly spell this out. Read them.)
Everything else will very likely lead to memory corruption sooner or later.

> +          /* silently ignore broken file entries */
> +          if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_FAILED))
> +            {
> +              g_propagate_error (error, err);
> +              g_clear_error (&err);

The GError warnings could be caused by not initializing error pointers (grep for
"GError +\*[[:alnum:]]+;"), or by reusing an error variable without clearing it
before. You MUST avoid passing an already initialized GError* as out parameter
into a function; propagating errors in a loop violates this.

You can learn more about error reporting in GLib here: 

Read it carefully; the detailed semantics are important.

More information about the Xfce4-dev mailing list