File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed
Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 2424class JobQueue : public JS ::JobQueue {
2525
2626public:
27- explicit JobQueue (JSContext *cx) : finalizationRegistryCallbacks(cx) {}
27+ explicit JobQueue (JSContext *cx);
2828~JobQueue () = default ;
2929
3030/* *
@@ -97,7 +97,7 @@ bool runFinalizationRegistryCallbacks(JSContext *cx);
9797private:
9898
9999using FunctionVector = JS::GCVector<JSFunction *, 0 , js::SystemAllocPolicy>;
100- JS::PersistentRooted<FunctionVector> finalizationRegistryCallbacks;
100+ JS::PersistentRooted<FunctionVector> * finalizationRegistryCallbacks;
101101
102102/* *
103103 * @brief Capture this JobQueue's current job queue as a SavedJobQueue and return it,
Original file line number Diff line number Diff line change 2020
2121#include < stdexcept>
2222
23+ JobQueue::JobQueue (JSContext *cx) {
24+ finalizationRegistryCallbacks = new JS::PersistentRooted<FunctionVector>(cx);
25+ }
26+
2327JSObject *JobQueue::getIncumbentGlobal (JSContext *cx) {
2428 return JS::CurrentGlobalOrNull (cx);
2529}
@@ -113,13 +117,13 @@ bool sendJobToMainLoop(PyObject *pyFunc) {
113117}
114118
115119void JobQueue::queueFinalizationRegistryCallback (JSFunction *callback) {
116- mozilla::Unused << finalizationRegistryCallbacks. append (callback);
120+ mozilla::Unused << finalizationRegistryCallbacks-> append (callback);
117121}
118122
119123bool JobQueue::runFinalizationRegistryCallbacks (JSContext *cx) {
120124 bool ranCallbacks = false ;
121125 JS::Rooted<FunctionVector> callbacks (cx);
122- std::swap (callbacks.get (), finalizationRegistryCallbacks. get ());
126+ std::swap (callbacks.get (), finalizationRegistryCallbacks-> get ());
123127 for (JSFunction *f: callbacks) {
124128 JS::ExposeObjectToActiveJS (JS_GetFunctionObject (f));
125129
Original file line number Diff line number Diff line change @@ -254,8 +254,8 @@ PyTypeObject JSObjectItemsProxyType = {
254254
255255static void cleanup () {
256256 delete autoRealm;
257- if (GLOBAL_CX) JS_DestroyContext (GLOBAL_CX);
258257 delete global;
258+ if (GLOBAL_CX) JS_DestroyContext (GLOBAL_CX);
259259 delete JOB_QUEUE;
260260 JS_ShutDown ();
261261}
You can’t perform that action at this time.
0 commit comments