www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22748] New: ~this() nogc { synchronized ...... } liable to

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

          Issue ID: 22748
           Summary: ~this()  nogc { synchronized ...... } liable to
                    onMemoryOperationError
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: destructionator gmail.com

I don't have a minimized example, this came up in the middle of a large work
application, but examining the source code and the stack trace reveals the
issue.

The destructor is  nogc hoping to avoid these, but this slipped through. I'm
not sure if it should actually fail the nogc check (though it does fail a
nothrow check which is interesting but not necessarily a bug per se), but
regardless we should do something.

synchronized(this) calls ensureMontior which calls GC.setAttr which throws the
invalid memory operation error.

--
Feb 08 2022