[gjs/gnome-3-24] closure: Prevent collection of invalidated closure
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/gnome-3-24] closure: Prevent collection of invalidated closure
- Date: Fri, 8 Sep 2017 03:42:02 +0000 (UTC)
commit 3e00e7adcba12c6b702ed77aba2721194843912e
Author: Philip Chimento <philip chimento gmail com>
Date: Tue Aug 22 22:58:56 2017 -0700
closure: Prevent collection of invalidated closure
It's not possible to stop tracing an object in the middle of GC. However,
by using JS::ExposeObjectToActiveJS(), it is possible to mark an object
as reachable for the duration of one GC. This is exactly what we need for
closures, to keep the closure's callable object from disappearing while
GC is going on.
https://bugzilla.gnome.org/show_bug.cgi?id=786668
https://bugzilla.gnome.org/show_bug.cgi?id=785657
gi/closure.cpp | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/gi/closure.cpp b/gi/closure.cpp
index 54971aa..9cbc60f 100644
--- a/gi/closure.cpp
+++ b/gi/closure.cpp
@@ -166,6 +166,7 @@ closure_set_invalid(gpointer data,
{
Closure *self = &((GjsClosure*) closure)->priv;
+ JS::ExposeObjectToActiveJS(self->obj);
self->obj.reset();
self->context = nullptr;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]