Skip to content
Commit 5ebd8f6e authored by Cosimo Cecchi's avatar Cosimo Cecchi Committed by Cosimo Cecchi
Browse files

gmain: add g_clear_handle_id API

It's a very common pattern to see code that looks like this in
dispose() or finalize() implementations:

if (priv->source_id > 0)
  {
    g_source_remove (priv->source_id);
    priv->source_id = 0;
  }

This API allows to accomplish the same goal with a single line:

g_clear_handle_id (&priv->source_id, (GClearHandleFunc) g_source_remove);

Thanks to Emmanuele Bassi <ebassi@gnome.org> for making the patch
generic.

https://bugzilla.gnome.org/show_bug.cgi?id=788489
parent 44d60525
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment