From 8e571669b3c8d4ac8236d0aed7a960bf88ad2bd1 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 2 Jun 2021 11:37:45 -0700 Subject: Fix cyclic reference in `ExtendedTypeLayout`. (#1868) --- source/slang/slang-reflection-api.cpp | 1 + source/slang/slang-type-layout.cpp | 2 +- source/slang/slang-type-layout.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'source/slang') diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp index 22f34a41a..059de0be8 100644 --- a/source/slang/slang-reflection-api.cpp +++ b/source/slang/slang-reflection-api.cpp @@ -1405,6 +1405,7 @@ namespace Slang RefPtr varLayout = new VarLayout(); varLayout->typeLayout = typeLayout; + varLayout->typeLayout.demoteToWeakReference(); for(auto typeResInfo : typeLayout->resourceInfos) { diff --git a/source/slang/slang-type-layout.cpp b/source/slang/slang-type-layout.cpp index f2869886e..42a93f3f0 100644 --- a/source/slang/slang-type-layout.cpp +++ b/source/slang/slang-type-layout.cpp @@ -2819,7 +2819,7 @@ static RefPtr maybeAdjustLayoutForArrayElementType( // If nothing needed to be changed on the inner element type, // then we are done. - if(adjustedInnerElementTypeLayout == originalInnerElementTypeLayout) + if (originalInnerElementTypeLayout == adjustedInnerElementTypeLayout) return originalTypeLayout; // TODO: actually adjust the element type, and create all the required bits and diff --git a/source/slang/slang-type-layout.h b/source/slang/slang-type-layout.h index 52b575787..be7ccdf8f 100644 --- a/source/slang/slang-type-layout.h +++ b/source/slang/slang-type-layout.h @@ -467,7 +467,7 @@ public: Name* getName() { return getVariable()->getName(); } // The result of laying out the variable's type - RefPtr typeLayout; + TransformablePtr typeLayout; TypeLayout* getTypeLayout() { return typeLayout.Ptr(); } // Additional flags -- cgit v1.2.3