F*cked by memory corruption after assiging value to associative array

ShadoLight ettienne.gilbert at gmail.com
Fri Jan 29 15:09:23 UTC 2021


On Monday, 25 January 2021 at 17:11:37 UTC, frame wrote:
> On Monday, 25 January 2021 at 16:54:42 UTC, vitamin wrote:
>> On Monday, 25 January 2021 at 16:44:40 UTC, frame wrote:
>>> On Monday, 25 January 2021 at 16:14:05 UTC, vitamin wrote:

>
> Yes, I directly calling on every function that returns an 
> object:
>
> T fun(T)(T object) {
>   GC.addRoot(cast(void*) object);
> }
> ...
> extern (C) export SomeObject bar() {
>     return fun(new SomeObject);
> }
>

Just to confirm... I assume you just neglected to show the line 
in fun template function that returns the object, right?

Like...

T fun(T)(T object) {
   GC.addRoot(cast(void*) object);
   return object;
}


More information about the Digitalmars-d-learn mailing list