[gjs: 3/5] engine: Free Cairo static data on shutdown
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 3/5] engine: Free Cairo static data on shutdown
- Date: Sat, 7 Apr 2018 17:11:06 +0000 (UTC)
commit 575f1e2e077af04a112b9e5eaabaf008b086568e
Author: Philip Chimento <philip chimento gmail com>
Date: Fri Mar 16 23:55:47 2018 -0700
engine: Free Cairo static data on shutdown
This is for the benefit of Valgrind memory reports.
gjs/engine.cpp | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/gjs/engine.cpp b/gjs/engine.cpp
index 67911eef..90fa57cf 100644
--- a/gjs/engine.cpp
+++ b/gjs/engine.cpp
@@ -37,6 +37,10 @@
#include <windows.h>
#endif
+#ifdef ENABLE_CAIRO
+# include <cairo.h>
+#endif
+
/* Implementations of locale-specific operations; these are used
* in the implementation of String.localeCompare(), Date.toLocaleDateString(),
* and so forth. We take the straight-forward approach of converting
@@ -214,6 +218,16 @@ on_promise_unhandled_rejection(JSContext *cx,
std::move(stack));
}
+static void
+shutdown(void)
+{
+ JS_ShutDown();
+
+#ifdef ENABLE_CAIRO
+ cairo_debug_reset_static_data(); /* for valgrind reports */
+#endif
+}
+
#ifdef G_OS_WIN32
HMODULE gjs_dll;
static bool gjs_is_inited = false;
@@ -231,7 +245,7 @@ LPVOID lpvReserved)
break;
case DLL_THREAD_DETACH:
- JS_ShutDown ();
+ shutdown();
break;
default:
@@ -251,7 +265,7 @@ public:
}
~GjsInit() {
- JS_ShutDown();
+ shutdown();
}
operator bool() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]