Skip to content

Commit 35637c1

Browse files
authored
Fix #10785 (#10787)
Check GC.inFinalizer when writing debug garbage to referenced GC array, as this is not valid to do when called from the GC.
1 parent d6608c9 commit 35637c1

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

std/uni/package.d

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,9 @@ alias sharSwitchLowerBound = sharMethod!switchUniformLowerBound;
17851785
{
17861786
debug
17871787
{
1788-
arr[] = cast(typeof(T.init[0]))(0xdead_beef);
1788+
import core.memory : GC;
1789+
if (!__ctfe && !GC.inFinalizer) // only do this if we are not in the GC finalizer
1790+
arr[] = cast(typeof(T.init[0]))(0xdead_beef);
17891791
}
17901792
arr = null;
17911793
}

0 commit comments

Comments
 (0)