diff options
Diffstat (limited to 'source/slang/slang.cpp')
| -rw-r--r-- | source/slang/slang.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 38ebcccd6..46ccb6ce9 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -4726,6 +4726,13 @@ void Session::addBuiltinSource( Session::~Session() { + // This is necessary because this ASTBuilder uses the SharedASTBuilder also owned by the session. + // If the SharedASTBuilder gets dtored before the globalASTBuilder it has a dangling pointer, which + // is referenced in the ASTBuilder dtor (likely) causing a crash. + // + // By destroying first we know it is destroyed, before the SharedASTBuilder. + globalAstBuilder.setNull(); + // destroy modules next stdlibModules = decltype(stdlibModules)(); } |
