www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22752] New: _d_delThrowable() may crash if a foreign

https://issues.dlang.org/show_bug.cgi?id=22752

          Issue ID: 22752
           Summary: _d_delThrowable() may crash if a foreign Throwable
                    object is being finalized by the GC
           Product: D
           Version: D2
          Hardware: All
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: frame86 live.com

It's currently possible to return a Throwable object from a D-DLL and throw it
in the main application.

While this is questionable use case - it's also a workaround for the poor
DLL-support because throwing from a DLL function directly crashes.

However, while earlier builds just crashes immediately if a foreign Throwable
object was thrown now the Throwable can be thrown but a timed bomb is plant in
_d_delThrowable() which causes the program later to crash if the GC decides to
finialize it later.

--
Feb 09 2022