summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@mengyan1223.wang>2022-01-27 10:16:32 +0000
committerJan Rybar <jrybar@redhat.com>2022-01-27 10:16:32 +0000
commita6bedfd09b7bba753de7a107dc471da0db801858 (patch)
treed1575d5344b4fd20bbb24b1d8ad26172e180b415 /src
parenta2bf5c9c83b6ae46cbd5c779d3055bff81ded683 (diff)
downloadpolkit-a6bedfd09b7bba753de7a107dc471da0db801858.tar.gz
jsauthority: port to mozjs-91
Diffstat (limited to 'src')
-rw-r--r--src/polkitbackend/polkitbackendjsauthority.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp
index 11e91c0..660407f 100644
--- a/src/polkitbackend/polkitbackendjsauthority.cpp
+++ b/src/polkitbackend/polkitbackendjsauthority.cpp
@@ -53,6 +53,13 @@
/* ---------------------------------------------------------------------------------------------------- */
+static class JsInitHelperType
+{
+public:
+ JsInitHelperType() { JS_Init(); }
+ ~JsInitHelperType() { JS_ShutDown(); }
+} JsInitHelper;
+
struct _PolkitBackendJsAuthorityPrivate
{
gchar **rules_dirs;
@@ -458,7 +465,6 @@ polkit_backend_common_js_authority_finalize (GObject *object)
delete authority->priv->js_polkit;
JS_DestroyContext (authority->priv->cx);
- /* JS_ShutDown (); */
G_OBJECT_CLASS (polkit_backend_js_authority_parent_class)->finalize (object);
}
@@ -490,7 +496,6 @@ polkit_backend_js_authority_class_init (PolkitBackendJsAuthorityClass *klass)
polkit_backend_common_js_authority_class_init_common (klass);
g_type_class_add_private (klass, sizeof (PolkitBackendJsAuthorityPrivate));
- JS_Init ();
}
/* ---------------------------------------------------------------------------------------------------- */