September 04, 2018 [Issue 19216] New: object.destroy doesn't handle Objective-C classes correctly | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19216 Issue ID: 19216 Summary: object.destroy doesn't handle Objective-C classes correctly Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: druntime Assignee: nobody@puremagic.com Reporter: doob@me.com 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 -- |
Copyright © 1999-2021 by the D Language Foundation