mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
js: Don't destroy the JS VM on shutdown
This avoids a crash in the fully static distribution build, due to static init order fiasco.
This commit is contained in:
parent
8d511b2f7b
commit
c898ee90cf
Notes:
github-actions[bot]
2024-11-18 07:24:09 +00:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/c898ee90cf2 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2413 Reviewed-by: https://github.com/awesomekling
1 changed files with 7 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/JsonValue.h>
|
#include <AK/JsonValue.h>
|
||||||
|
#include <AK/NeverDestroyed.h>
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/ConfigFile.h>
|
#include <LibCore/ConfigFile.h>
|
||||||
|
@ -30,7 +31,10 @@
|
||||||
#include <LibTextCodec/Decoder.h>
|
#include <LibTextCodec/Decoder.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
RefPtr<JS::VM> g_vm;
|
// FIXME: https://github.com/LadybirdBrowser/ladybird/issues/2412
|
||||||
|
// We should be able to destroy the VM on process exit.
|
||||||
|
NeverDestroyed<RefPtr<JS::VM>> g_vm_storage;
|
||||||
|
JS::VM* g_vm;
|
||||||
Vector<String> g_repl_statements;
|
Vector<String> g_repl_statements;
|
||||||
GC::Root<JS::Value> g_last_value = GC::make_root(JS::js_undefined());
|
GC::Root<JS::Value> g_last_value = GC::make_root(JS::js_undefined());
|
||||||
|
|
||||||
|
@ -555,7 +559,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
AK::set_debug_enabled(!disable_debug_printing);
|
AK::set_debug_enabled(!disable_debug_printing);
|
||||||
s_history_path = TRY(String::formatted("{}/.js-history", Core::StandardPaths::home_directory()));
|
s_history_path = TRY(String::formatted("{}/.js-history", Core::StandardPaths::home_directory()));
|
||||||
|
|
||||||
g_vm = TRY(JS::VM::create());
|
g_vm_storage.get() = TRY(JS::VM::create());
|
||||||
|
g_vm = g_vm_storage->ptr();
|
||||||
g_vm->set_dynamic_imports_allowed(true);
|
g_vm->set_dynamic_imports_allowed(true);
|
||||||
|
|
||||||
if (!disable_debug_printing) {
|
if (!disable_debug_printing) {
|
||||||
|
|
Loading…
Reference in a new issue