[gimp] app: unref async when removing last callback if idle is pending
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: unref async when removing last callback if idle is pending
- Date: Fri, 30 Nov 2018 09:16:36 +0000 (UTC)
commit a779dd38494e89eb91c4dc1fe23fcc5de321137f
Author: Ell <ell_se yahoo com>
Date: Fri Nov 30 03:09:21 2018 -0500
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.)
app/core/gimpasync.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/app/core/gimpasync.c b/app/core/gimpasync.c
index b1f3e932b7..7a57f0f674 100644
--- a/app/core/gimpasync.c
+++ b/app/core/gimpasync.c
@@ -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.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]