Use of mutex in destructors

Dmitry Olshansky dmitry.olsh at gmail.com
Fri Apr 27 05:03:11 PDT 2012


On 27.04.2012 15:53, Simen Kjaeraas wrote:
> On Fri, 27 Apr 2012 13:23:00 +0200, Dmitry Olshansky
> <dmitry.olsh at gmail.com> wrote:
>
>> On 27.04.2012 15:15, Rene Zwanenburg wrote:
>>> Since an OpenGL context is owned by one thread, any OpenGL calls made
>>> from other threads will fail. I've wrapped OpenGL 'objects' in D classes
>>> to automate destruction of the underlying object:
>>>
>> How about using structs for GL objects? It's not like you have a
>> hierarchy or interfaces in there.
>>
>> [snip]
>>
>
> http://d.puremagic.com/issues/show_bug.cgi?id=2834
>
> Heap-allocated structs don't have their destructors called when they're
> collected.

Boom! Just LOL...

Use manual memory management or ref-counting. If std.container.Array was 
not so bogus I'd recommend it for arrays.

-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list