summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 9bfc2bce9..e76ff7436 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -1496,13 +1496,29 @@ static void outputExceptionDiagnostic(
DiagnosticSink& sink,
slang::IBlob** outDiagnostics)
{
- sink.diagnoseRaw(Severity::Internal, exception.Message.getUnownedSlice());
+ try
+ {
+ sink.diagnoseRaw(Severity::Internal, exception.Message.getUnownedSlice());
+ }
+ catch (const AbortCompilationException&)
+ {
+ // Catch and ignore the AbortCompilationException that diagnoseRaw throws
+ // for Internal severity to prevent exception leak from loadModule
+ }
sink.getBlobIfNeeded(outDiagnostics);
}
static void outputExceptionDiagnostic(DiagnosticSink& sink, slang::IBlob** outDiagnostics)
{
- sink.diagnoseRaw(Severity::Fatal, "An unknown exception occurred");
+ try
+ {
+ sink.diagnoseRaw(Severity::Fatal, "An unknown exception occurred");
+ }
+ catch (const AbortCompilationException&)
+ {
+ // Catch and ignore the AbortCompilationException that diagnoseRaw throws
+ // for Fatal severity to prevent exception leak from loadModule
+ }
sink.getBlobIfNeeded(outDiagnostics);
}