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?
I do not know this library, but if you get
InvalidMemoryOperationError it likely mean that you call in class
dtor some function, which causes GC allocation. In your case it
seems that you call sfImage_destroy(image) which might do such
things.