From 9603fde866eacdde6c7cb93b04138b637a505079 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Wed, 19 Feb 2020 13:25:13 -0800 Subject: Fix a reference-counting bug in one of the session creation routines. (#1230) This is pretty straightforward, because we were calling `Session::init` (which can retain/release the session) on a `Session*` (no reference held). The catch is that our current tests use the older form of the Slang API, while Falcor relies on the newer API, and so the recent change to our reference-counting logic introduced a regression that we didn't detect in testing. This change just fixes the direct issue but doesn't address the gap in testing. A better long-term fix would be to fully define our "1.0" API, shift our testing to it, and layer the old API on top of it (to try and avoid regressions for client code). --- source/slang/slang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/slang/slang.cpp') diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 5fdec8259..08c996fd2 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -2632,7 +2632,7 @@ SLANG_API SlangResult slang_createGlobalSession( if(apiVersion != 0) return SLANG_E_NOT_IMPLEMENTED; - Slang::Session* globalSession = new Slang::Session(); + Slang::RefPtr globalSession(new Slang::Session()); globalSession->init(); Slang::ComPtr result(Slang::asExternal(globalSession)); *outGlobalSession = result.detach(); -- cgit v1.2.3