[gjs] Windows: Fix DllMain() for running on SpiderMonkey 38



commit b48673891d22654d83e3fd08b51bb41be9d3331d
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Sat Feb 18 21:45:09 2017 +0800

    Windows: Fix DllMain() for running on SpiderMonkey 38
    
    It appears that we need to call JS_ShutDown() during DLL_THREAD_DETACH
    right after we call gjs_destroy_runtime_for_current_thread(), otherwise
    when for example gjs-console finishes running the script, it will not exit
    as the SpiderMonkey JS engine did not ShutDown.  This appears to be in
    line with what is done on non-Windows.
    
    We still need to call JS_Init() during DLL_PROCESS_ATTACH (which is
    simplified a bit, as we can just set gjs_is_inited based on the results
    of JS_Init() and so assert later on that JS_Init() did indeed succeed).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775868

 gjs/runtime.cpp |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
---
diff --git a/gjs/runtime.cpp b/gjs/runtime.cpp
index cc0d704..37d9fc0 100644
--- a/gjs/runtime.cpp
+++ b/gjs/runtime.cpp
@@ -246,15 +246,11 @@ LPVOID    lpvReserved)
   {
   case DLL_PROCESS_ATTACH:
     gjs_dll = hinstDLL;
-    g_assert(JS_Init());
-    gjs_is_inited = true;
+    gjs_is_inited = JS_Init();
     break;
 
   case DLL_THREAD_DETACH:
     gjs_destroy_runtime_for_current_thread();
-    break;
-
-  case DLL_PROCESS_DETACH:
     JS_ShutDown ();
     break;
 


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