summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel van Vugt <daniel.van.vugt@canonical.com>2023-04-05 17:48:22 +0800
committerDaniel van Vugt <daniel.van.vugt@canonical.com>2023-04-13 14:35:28 +0800
commit1b49495e762e051d60c7e2efda038de9eea4a214 (patch)
tree927e988e7d2235a9a38b29b1014727482914a073
parent3be5116537e45984ecaf8f6c522ff6613aa7d9d4 (diff)
downloadgjs-1b49495e762e051d60c7e2efda038de9eea4a214.tar.gz
context: Clear all vectors of JS::Heap on dispose
Otherwise we might still have some `JS::Heap`s lingering after `JS_DestroyContext`, which will fail to destruct (crash) when their destructors are called later in `~GjsContextPrivate()`. Fixes: https://gitlab.gnome.org/GNOME/gjs/-/issues/472
-rw-r--r--gjs/context.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 59ac8afd..6c66f1ac 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -471,6 +471,9 @@ void GjsContextPrivate::dispose(void) {
delete m_gtype_table;
delete m_atoms;
+ m_job_queue.clear();
+ m_object_init_list.clear();
+
/* Tear down JS */
JS_DestroyContext(m_cx);
m_cx = nullptr;