[seed] seed_init_with_context: reuse existing context group



commit 7847cbfb332a29d04237df02611515cc6b8710fa
Author: Alban Crequy <alban crequy collabora co uk>
Date:   Mon Jan 28 12:47:54 2013 +0000

    seed_init_with_context: reuse existing context group
    
    When initializing seed with an existing context, reuse its context group rather
    than creating a new one. Contexts always exist inside a context group.
    
    Seed creates a temporary context when importing modules (from GObject
    introspection or otherwise) and passes variables between the contexts. Contexts
    must be in the same context group, otherwise the behaviour is undefined.
    
    This fixes a crash when creating a new GObject from the javascript code.

 libseed/seed-engine.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index 7165b11..8a924f2 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -1866,7 +1866,7 @@ seed_init (gint * argc, gchar *** argv)
 SeedEngine *
 seed_init_with_context (gint * argc, gchar *** argv, JSGlobalContextRef context)
 {
-  context_group = JSContextGroupCreate ();
+  context_group = JSContextGetGroup (context);
 
   return seed_init_with_context_and_group (argc, argv, context, context_group);
 }


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