Derelict SFML destructor crashes

Nekroze nekroze at eturnilnetwork.com
Sun Dec 16 08:30:26 PST 2012


On Sunday, 16 December 2012 at 15:21:46 UTC, Nekroze wrote:
> On Sunday, 16 December 2012 at 14:59:32 UTC, Maxim Fomin wrote:
>> On Sunday, 16 December 2012 at 14:42:57 UTC, Nekroze wrote:
>>> I am trying to do some wrapping of the CSFML derelict 
>>> bindings to classes however when i use the CSFML methods to 
>>> destroy the objects it causes a crash.
>>>
>>> I have made a post in the SFML>D forum because they have 
>>> syntax highlighting for D so this kind of post looks nicer 
>>> but the link is here:
>>>
>>> http://en.sfml-dev.org/forums/index.php?topic=10005.0
>>>
>>> There is a minimal code example there and a better 
>>> explanation.
>>>
>>> Can anyone help me with why this is happening?
>>
>> Why would you call a destroy() on a this object inside 
>> ~this()? And accessing allocated by GC objects inside 
>> destructor is not safe, because they may be collected before 
>> running the destructor.
>
> I am sorry if i am being dim but i thought that the sfml 
> objects are not GC objects so it will exist forever until i 
> call its destroy function so why cant this be done in the 
> destructor? Unless you mean the pointer is being destroyed 
> before the destructor is being called?

To me it makes sense to use the sfml objects destroy function 
when the my object gets destroyed regardless of when it happens.

It cant be that i have to have a separate destroy method for my 
class that i must manually use each time. kind of kills the point 
of having a GC then doesn't it?

Like i said sorry if i am being dim that just makes sense to me.


More information about the Digitalmars-d-learn mailing list