Commit a779dd38 authored by Ell's avatar Ell

app: unref async when removing last callback if idle is pending

In gimp_async_remove_callback(), if removing the last callback
while the callback idle-source is already pending, cancel the idle
source and unref the async object (the async is reffed when adding
the idle source.)
parent 4dd3e219
......@@ -467,7 +467,8 @@ gimp_async_remove_callback (GimpAsync *async,
GimpAsyncCallback callback,
gpointer data)
{
GList *iter;
GList *iter;
gboolean unref_async = FALSE;
g_return_if_fail (GIMP_IS_ASYNC (async));
g_return_if_fail (callback != NULL);
......@@ -492,7 +493,18 @@ gimp_async_remove_callback (GimpAsync *async,
iter = next;
}
if (g_queue_is_empty (&async->priv->callbacks) && async->priv->idle_id)
{
g_source_remove (async->priv->idle_id);
async->priv->idle_id = 0;
unref_async = TRUE;
}
g_mutex_unlock (&async->priv->mutex);
if (unref_async)
g_object_unref (async);
}
/* checks if 'async' is in the "stopped" state.
......
Markdown is supported
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