https://github.com/shader-slang/slang
Revision 63bed4c37199f2436c81089a08834d7b58b8e576 authored by Tim Foley on 09 January 2020, 19:26:06 UTC, committed by Tim Foley on 09 January 2020, 19:26:06 UTC
If `spReflection_FindTypeByName` is called with a string that refers to the name of a variable instead of a type, then it ends up causing a fatal error to be diagnosed, leading to an `AbortCompilationException` being thrown. This exception then propagates up to the application that called `spReflection_FindTypeByName()`, which actually violates the contract for our `extern "C"` API.

This change adds a wrapper `try`/`catch` around the meat of the operation and turns any exception into a null result (this function has no other way to report errors to the caller).

It would be nice for a separate change to make the error message that caused the problem non-fatal, but that is orthogonal to this fix.
1 parent 0a856f4
History
Tip revision: 63bed4c37199f2436c81089a08834d7b58b8e576 authored by Tim Foley on 09 January 2020, 19:26:06 UTC
Catch exceptions inside FindTypeByName()
Tip revision: 63bed4c
File Mode Size
docs
examples
external
prelude
source
tests
tools
.editorconfig -rw-r--r-- 937 bytes
.gitattributes -rw-r--r-- 95 bytes
.gitignore -rw-r--r-- 480 bytes
.gitmodules -rw-r--r-- 774 bytes
.travis.yml -rw-r--r-- 1.7 KB
CODE_OF_CONDUCT.md -rw-r--r-- 3.1 KB
LICENSE -rw-r--r-- 1.1 KB
README.md -rw-r--r-- 7.1 KB
appveyor.yml -rw-r--r-- 4.0 KB
premake5.lua -rw-r--r-- 29.4 KB
slang-com-helper.h -rw-r--r-- 4.8 KB
slang-com-ptr.h -rw-r--r-- 4.8 KB
slang-tag-version.h -rw-r--r-- 36 bytes
slang.h -rw-r--r-- 123.9 KB
slang.sln -rw-r--r-- 9.9 KB
test.bat -rw-r--r-- 1.4 KB
travis_build.sh -rw-r--r-- 460 bytes
travis_test.sh -rw-r--r-- 435 bytes

README.md

back to top