Bug 19216 – object.destroy doesn't handle Objective-C classes correctly

Status
NEW
Severity
normal
Priority
P3
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-09-04T11:26:50Z
Last change time
2024-12-07T13:38:32Z
Keywords
objc
Assigned to
No Owner
Creator
Jacob Carlborg
Moved to GitHub: dmd#17369 →

Comments

Comment #0 by doob — 2018-09-04T11:26:50Z
The code for "object.destroy" for classes looks like: void destroy(T)(T obj) if (is(T == class)) { static if(__traits(getLinkage, T) == "C++") { obj.__xdtor(); enum classSize = __traits(classInstanceSize, T); (cast(void*)obj)[0 .. classSize] = typeid(T).initializer[]; } else rt_finalize(cast(void*)obj); } The code should check for Objective-C and potentially COM classes as well. https://github.com/dlang/druntime/blob/14bd877bc51014baf9090175f2e690d8e1ec3a4a/src/object.d#L562
Comment #1 by robert.schadek — 2024-12-07T13:38:32Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17369 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB