From 1b49495e762e051d60c7e2efda038de9eea4a214 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Wed, 5 Apr 2023 17:48:22 +0800 Subject: 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 --- gjs/context.cpp | 3 +++ 1 file changed, 3 insertions(+) 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; -- cgit v1.2.1