Bug 17642 – Specify in the documentation for destructors the problem with the error InvalidMemoryOperationError

Status
NEW
Severity
enhancement
Priority
P4
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-07-12T18:19:11Z
Last change time
2024-12-15T15:24:10Z
Assigned to
No Owner
Creator
Alexey Kulentsov
Moved to GitHub: dlang.org#4067 →

Comments

Comment #0 by crimaniak — 2017-07-12T18:19:11Z
The current implementation of GC is not re-enterable so users regularly receive an unexpected InvalidMemoryOperationError. The only reliable way to avoid this error is not to create garbage-collected instances of objects or structs with non-@nogc destructor. There is no information about it in the documentation, except error itself description. Nobody reads all possible errors descriptions before writing code. So then user faced this error usually it's too late to change architecture and think about ~this() @nogc. So I propose to add info about this error and how to avoid this to destructors documentation page https://dlang.org/spec/class.html#destructors or as minimum write a short warning about and give the link to the page with extended info https://wiki.dlang.org/InvalidMemoryOperationError
Comment #1 by robert.schadek — 2024-12-15T15:24:10Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dlang.org/issues/4067 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB