[gjs] context: Properly create const strings array



commit 810a42a3a618f58f27223925f68cc379366a76c3
Author: Philip Chimento <philip endlessm com>
Date:   Tue Jul 18 18:42:03 2017 -0700

    context: Properly create const strings array
    
    The std::array object in GjsContext never had its constructor and
    destructor called. That happens to work, but it depends on the
    implementation, so do it properly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784713

 gjs/context.cpp |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gjs/context.cpp b/gjs/context.cpp
index a5998f4..ab2faed 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -287,6 +287,7 @@ gjs_context_finalize(GObject *object)
     g_mutex_unlock(&contexts_lock);
 
     js_context->global.~Heap();
+    js_context->const_strings.~array();
     js_context->unhandled_rejection_stacks.~unordered_map();
     G_OBJECT_CLASS(gjs_context_parent_class)->finalize(object);
 }
@@ -307,6 +308,7 @@ gjs_context_constructed(GObject *object)
     js_context->context = cx;
 
     new (&js_context->unhandled_rejection_stacks) std::unordered_map<uint64_t, GjsAutoChar>;
+    new (&js_context->const_strings) std::array<JS::PersistentRootedId*, GJS_STRING_LAST>;
     for (i = 0; i < GJS_STRING_LAST; i++) {
         js_context->const_strings[i] = new JS::PersistentRootedId(cx,
             gjs_intern_string_to_id(cx, const_strings[i]));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]