[gjs/gnome-3-24] object: Don't invalidate closure if already invalid
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/gnome-3-24] object: Don't invalidate closure if already invalid
- Date: Wed, 21 Jun 2017 18:40:04 +0000 (UTC)
commit 309a56f22dec89aa38efb523ebb11c8cef42ebf5
Author: Philip Chimento <philip endlessm com>
Date: Mon Jun 19 16:19:07 2017 -0700
object: Don't invalidate closure if already invalid
In object_instance_finalize() we get two kinds of signal connections:
ones that are still connected, which we need to invalidate; and ones that
have just been disconnected and invalidated but whose invalidate idle
function has not yet run.
The second kind we just need to disconnect the idle handler and free the
ConnectData. We should not try to remove the invalidate notifier, since
it has already run. The first kind, we must remove the invalidate
notifier so that no idle invalidation is scheduled, and then invalidate
them, and also free the ConnectData.
Previously we were mixing the two and removing notifiers from both kinds.
This led to warnings about removing uninstalled invalidation notifiers.
https://bugzilla.gnome.org/show_bug.cgi?id=783951
gi/object.cpp | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 0cce454..9c8ffd9 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1631,15 +1631,16 @@ object_instance_finalize(JSFreeOp *fop,
*/
for (ConnectData *cd : priv->signals) {
/* First remove any pending invalidation, we are doing it now. */
- if (cd->idle_invalidate_id > 0)
+ if (cd->idle_invalidate_id > 0) {
g_source_remove(cd->idle_invalidate_id);
+ } else {
+ /* We have to remove the invalidate notifier, which would
+ * otherwise schedule a new pending invalidation. */
+ g_closure_remove_invalidate_notifier(cd->closure, cd,
+ signal_connection_invalidated);
+ g_closure_invalidate(cd->closure);
+ }
- /* We also have to remove the invalidate notifier, which would
- * otherwise schedule a new pending invalidation. */
- g_closure_remove_invalidate_notifier(cd->closure, cd,
- signal_connection_invalidated);
-
- g_closure_invalidate(cd->closure);
g_slice_free(ConnectData, cd);
}
priv->signals.clear();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]