[gjs] context: Handle dispose notify manually
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] context: Handle dispose notify manually
- Date: Wed, 19 May 2021 05:12:30 +0000 (UTC)
commit 6daf41c4796a57584e5755a522971a6374eb2b67
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date: Tue May 18 10:43:51 2021 +0200
context: Handle dispose notify manually
There's no need to add a weak ref on context, we can just handle this on
disposition (but to ensure this happens once as the weak ref does, we
check if context is set)
gjs/context.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gjs/context.cpp b/gjs/context.cpp
index db8e294b..948ca8c6 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -368,6 +368,9 @@ gjs_context_dispose(GObject *object)
gjs_object_clear_toggles();
gjs_object_shutdown_toggle_queue();
+ if (gjs->context())
+ ObjectInstance::context_dispose_notify(nullptr, object);
+
/* Run dispose notifications next, so that anything releasing
* references in response to this can still get garbage collected */
gjs_debug(GJS_DEBUG_CONTEXT,
@@ -480,8 +483,6 @@ gjs_context_constructed(GObject *object)
g_mutex_unlock(&contexts_lock);
setup_dump_heap();
-
- g_object_weak_ref(object, &ObjectInstance::context_dispose_notify, nullptr);
}
GjsContextPrivate::GjsContextPrivate(JSContext* cx, GjsContext* public_context)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]