Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 72df9d3

Browse files
authored
Dwarf EH: explicitly remove our reference to caught Throwable
We should explicitly remove our reference to the caught Throwable, such that there are no lingering references to it. This enables the code in line 71 to work (where we want to reuse the preallocated ehstorage). Without this patch, only the very first exception thrown is using `ehstorage` and all other exceptions cannot use that struct any more because of the dangling ehstorage.object reference.
1 parent 4387aca commit 72df9d3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/rt/dwarfeh.d

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ extern(C) Throwable __dmd_begin_catch(_Unwind_Exception* exceptionObject)
142142
//printf("__dmd_begin_catch(%p), object = %p\n", eh, eh.object);
143143

144144
auto o = eh.object;
145+
// Remove our reference to the exception. We should not decrease its refcount,
146+
// because we pass the object on to the caller.
147+
eh.object = null;
145148

146149
// Pop off of chain
147150
if (eh != ExceptionHeader.pop())

0 commit comments

Comments
 (0)