[gjs/ewlsh/fix-barried-get-in-rooting] Enqueue toggle ups when the heap is collecting
- From: Evan Welsh <ewlsh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/ewlsh/fix-barried-get-in-rooting] Enqueue toggle ups when the heap is collecting
- Date: Wed, 28 Jul 2021 04:59:11 +0000 (UTC)
commit 5a829ced5349908896a804827d9a91fd242d12e3
Author: Evan Welsh <contact evanwelsh com>
Date: Tue Jul 27 21:59:04 2021 -0700
Enqueue toggle ups when the heap is collecting
gi/object.cpp | 3 ++-
gjs/jsapi-util-root.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 3bfa42e8..08dbd38f 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1353,7 +1353,8 @@ void ObjectInstance::wrapped_gobj_toggle_notify(void* instance, GObject*,
* The JSObject associated with the gobject is not rooted,
* but it needs to be. We'll root it.
*/
- if (is_main_thread && !anything_queued) {
+ if (is_main_thread && !anything_queued &&
+ !JS::RuntimeHeapIsCollecting()) {
self->toggle_up();
} else {
toggle_queue->enqueue(self, ToggleQueue::UP, toggle_handler);
diff --git a/gjs/jsapi-util-root.h b/gjs/jsapi-util-root.h
index cf6369a7..5433a09b 100644
--- a/gjs/jsapi-util-root.h
+++ b/gjs/jsapi-util-root.h
@@ -276,7 +276,7 @@ class GjsMaybeOwned {
/* Prevent the thing from being garbage collected while it is in neither
* m_heap nor m_root */
- JS::Rooted<T> thing(cx, m_heap.unbarrieredGet());
+ JS::Rooted<T> thing(cx, m_heap);
reset();
root(cx, thing, notify, data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]