diff options
author | Miloslav Trmač <mitr@redhat.com> | 2014-07-01 20:00:48 +0200 |
---|---|---|
committer | Miloslav Trmač <mitr@redhat.com> | 2015-06-19 04:30:52 +0200 |
commit | 5c668722320eb363f713a0998934aa48fecd56cb (patch) | |
tree | dc00b5cc769b56d6aa59c7d328f6a08f8e67fba8 /src | |
parent | 57e2d86edc2630cac1812a3285715dad795a4bd6 (diff) | |
download | polkit-5c668722320eb363f713a0998934aa48fecd56cb.tar.gz |
Register heap-based JSObject pointers to GC
This is necessary so that the GC can move the objects (though I haven't
so far encountered this in testing).
https://bugs.freedesktop.org/show_bug.cgi?id=69501
Diffstat (limited to 'src')
-rw-r--r-- | src/polkitbackend/polkitbackendjsauthority.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/polkitbackend/polkitbackendjsauthority.c b/src/polkitbackend/polkitbackendjsauthority.c index 88f31bd..39f7060 100644 --- a/src/polkitbackend/polkitbackendjsauthority.c +++ b/src/polkitbackend/polkitbackendjsauthority.c @@ -482,6 +482,7 @@ polkit_backend_js_authority_constructed (GObject *object) if (authority->priv->js_global == NULL) goto fail; + JS_AddObjectRoot (authority->priv->cx, &authority->priv->js_global); if (!JS_InitStandardClasses (authority->priv->cx, authority->priv->js_global)) goto fail; @@ -494,6 +495,7 @@ polkit_backend_js_authority_constructed (GObject *object) JSPROP_ENUMERATE); if (authority->priv->js_polkit == NULL) goto fail; + JS_AddObjectRoot (authority->priv->cx, &authority->priv->js_polkit); if (!JS_DefineFunctions (authority->priv->cx, authority->priv->js_polkit, @@ -572,6 +574,11 @@ polkit_backend_js_authority_finalize (GObject *object) g_free (authority->priv->dir_monitors); g_strfreev (authority->priv->rules_dirs); + JS_BeginRequest (authority->priv->cx); + JS_RemoveObjectRoot (authority->priv->cx, &authority->priv->js_polkit); + JS_RemoveObjectRoot (authority->priv->cx, &authority->priv->js_global); + JS_EndRequest (authority->priv->cx); + JS_DestroyContext (authority->priv->cx); JS_DestroyRuntime (authority->priv->rt); /* JS_ShutDown (); */ |