[gjs/wip/ptomato/mozjs38: 6/29] WIP - object: split out clear pending toggles
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs38: 6/29] WIP - object: split out clear pending toggles
- Date: Mon, 6 Feb 2017 06:26:46 +0000 (UTC)
commit 0224365f13fef483786801306280444d7fb1cb80
Author: Philip Chimento <philip endlessm com>
Date: Thu Feb 2 16:16:01 2017 -0800
WIP - object: split out clear pending toggles
https://bugzilla.gnome.org/show_bug.cgi?id=776966
gi/object.cpp | 16 +++++++++++-----
gi/object.h | 2 ++
2 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index da92787..8b63651 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1240,6 +1240,15 @@ release_native_object (ObjectInstance *priv)
* pending toggle references.
*/
void
+gjs_object_clear_toggles(void)
+{
+ while (g_main_context_pending(NULL) &&
+ g_atomic_int_get(&pending_idle_toggles) > 0) {
+ g_main_context_iteration(NULL, false);
+ }
+}
+
+void
gjs_object_prepare_shutdown (JSContext *context)
{
JSObject *keep_alive = gjs_keep_alive_get_global_if_exists (context);
@@ -1251,13 +1260,10 @@ gjs_object_prepare_shutdown (JSContext *context)
return;
/* First, get rid of anything left over on the main context */
- while (g_main_context_pending(NULL) &&
- g_atomic_int_get(&pending_idle_toggles) > 0) {
- g_main_context_iteration(NULL, false);
- }
+ gjs_object_clear_toggles();
/* Now, we iterate over all of the objects, breaking the JS <-> C
- * associaton. We avoid the potential recursion implied in:
+ * association. We avoid the potential recursion implied in:
* toggle ref removal -> gobj dispose -> toggle ref notify
* by simply ignoring toggle ref notifications during this process.
*/
diff --git a/gi/object.h b/gi/object.h
index 92744e1..d37d1df 100644
--- a/gi/object.h
+++ b/gi/object.h
@@ -58,6 +58,8 @@ bool gjs_typecheck_is_object(JSContext *context,
void gjs_object_prepare_shutdown (JSContext *context);
+void gjs_object_clear_toggles(void);
+
void gjs_object_define_static_methods(JSContext *context,
JS::HandleObject constructor,
GType gtype,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]