Re: Derelict SFML destructor crashes

2012-12-18 Thread Mike Parker
On Tuesday, 18 December 2012 at 07:36:09 UTC, Rob T wrote: On Monday, 17 December 2012 at 04:40:39 UTC, Mike Parker wrote: First, please take all Derelict trouble-shooting problems to the Derelict forums[1]. I'm posting here because I was unable to register with the derelict forum. I

Re: Derelict SFML destructor crashes

2012-12-18 Thread Mike Parker
On Tuesday, 18 December 2012 at 08:14:01 UTC, Mike Parker wrote: On Tuesday, 18 December 2012 at 07:36:09 UTC, Rob T wrote: On Monday, 17 December 2012 at 04:40:39 UTC, Mike Parker wrote: First, please take all Derelict trouble-shooting problems to the Derelict forums[1]. I'm posting here

Re: Derelict SFML destructor crashes

2012-12-18 Thread Jeremy DeHaan
On Tuesday, 18 December 2012 at 07:36:09 UTC, Rob T wrote: On Monday, 17 December 2012 at 04:40:39 UTC, Mike Parker wrote: First, please take all Derelict trouble-shooting problems to the Derelict forums[1]. I'm posting here because I was unable to register with the derelict forum. I

Re: Derelict SFML destructor crashes

2012-12-18 Thread Mike Parker
On Tuesday, 18 December 2012 at 07:36:09 UTC, Rob T wrote: On Monday, 17 December 2012 at 04:40:39 UTC, Mike Parker wrote: First, please take all Derelict trouble-shooting problems to the Derelict forums[1]. I'm posting here because I was unable to register with the derelict forum. I

Re: Derelict SFML destructor crashes

2012-12-18 Thread Rob T
On Tuesday, 18 December 2012 at 13:47:43 UTC, Mike Parker wrote: I *think* I've got it sorted. If you try again, it should work. I tried it again just now and it worked. Thanks! --rt

Re: Derelict SFML destructor crashes

2012-12-17 Thread Jeremy DeHaan
I am somewhat confused by some things that are being talked about in this thread. Mike Parker said that this Image is handled by GC. Would that mean that any class members are handled by the GC too? If so, wouldn't the sfImage* be collected by the GC? If not, and you DO need to manually

Re: Derelict SFML destructor crashes

2012-12-17 Thread Mike Parker
On Monday, 17 December 2012 at 08:23:02 UTC, Jeremy DeHaan wrote: I am somewhat confused by some things that are being talked about in this thread. Mike Parker said that this Image is handled by GC. Would that mean that any class members are handled by the GC too? If so, wouldn't the

Re: Derelict SFML destructor crashes

2012-12-17 Thread Jacob Carlborg
On 2012-12-17 09:23, Jeremy DeHaan wrote: And how does calling destroy/delete in a struct destructor differ from doing the same in a class destructor? I too would like to make sure I am not getting any memory leaks! Because there are guarantees how and when a destructor for a struct is

Re: Derelict SFML destructor crashes

2012-12-17 Thread Jeremy DeHaan
Thanks for all the info, Mike. I come from a C# background, so I have pretty much 0 experience when it comes to handling memory myself(let alone working with a binding to another language) and I haven't read my D book as much as I would like. I'm not quite sure what you are referring to when

Re: Derelict SFML destructor crashes

2012-12-17 Thread Jeremy DeHaan
On Monday, 17 December 2012 at 09:52:08 UTC, Jacob Carlborg wrote: On 2012-12-17 09:23, Jeremy DeHaan wrote: And how does calling destroy/delete in a struct destructor differ from doing the same in a class destructor? I too would like to make sure I am not getting any memory leaks! Because

Re: Derelict SFML destructor crashes

2012-12-17 Thread Nekroze
On Monday, 17 December 2012 at 10:56:23 UTC, Jeremy DeHaan wrote: Does that mean that putting some form of delete in a struct destructor will be called to delete contents or is that still considered unsafe? And why don't classes have the same guarantee? Is it because they are a reference

Re: Derelict SFML destructor crashes

2012-12-17 Thread Nekroze
On Monday, 17 December 2012 at 12:08:29 UTC, Nekroze wrote: Now what i was thinking as a solution, would it be possible to manually run the GC cleanup pass at the end of main this way we know that the GC cleanup would run before main exits and thus sfml gets unloaded. Although i believe this

Re: Derelict SFML destructor crashes

2012-12-17 Thread Mike Parker
On Monday, 17 December 2012 at 10:39:56 UTC, Jeremy DeHaan wrote: I tried putting destroy in the destructor like the code I wrote. Like I said, it gave me no memory errors, but I don't actually know if it even does anything. I honestly think that it is weird to not be able to rely on

Re: Derelict SFML destructor crashes

2012-12-17 Thread Mike Parker
On Monday, 17 December 2012 at 12:08:29 UTC, Nekroze wrote: Structs have their destructors called, as far as i understand, as soon as you go out of the scope they are defined in. Not sure how that works with structs that are members of a class but i assume that has the same problems as a

Re: Derelict SFML destructor crashes

2012-12-17 Thread Nekroze
On Monday, 17 December 2012 at 14:06:30 UTC, Mike Parker wrote: Now what i was thinking as a solution, would it be possible to manually run the GC cleanup pass at the end of main this way we know that the GC cleanup would run before main exits and thus sfml gets unloaded. Although i believe

Re: Derelict SFML destructor crashes

2012-12-17 Thread Jeremy DeHaan
It's not the only way, but it's the easiest way. What are some other ways? I am just curious. Also, if we were able to know the size of the object the pointer is referring to, couldn't we then add it to the GC? It sounds like a pretty complicated way, but wouldn't that be a good way if it

Re: Derelict SFML destructor crashes

2012-12-17 Thread Mike Parker
On Monday, 17 December 2012 at 22:08:08 UTC, Jeremy DeHaan wrote: It's not the only way, but it's the easiest way. What are some other ways? I am just curious. You could use module destructors to cleanup at program exit and use RAII via struct destructors for short-lived objects. Also,

Re: Derelict SFML destructor crashes

2012-12-17 Thread Jeremy DeHaan
On Tuesday, 18 December 2012 at 01:24:43 UTC, Mike Parker wrote: No, that's a bad idea. What if the C library you are using maintains some sort of internal bookkeeping related to the pointer? What if it keeps a copy of the pointer internally? If the GC collects your D-side pointer, how is the

Re: Derelict SFML destructor crashes

2012-12-17 Thread Rob T
On Monday, 17 December 2012 at 04:40:39 UTC, Mike Parker wrote: First, please take all Derelict trouble-shooting problems to the Derelict forums[1]. I'm posting here because I was unable to register with the derelict forum. I filled out the registration form and press the register button,

Re: Derelict SFML destructor crashes

2012-12-16 Thread Maxim Fomin
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 SFMLD forum because they have syntax highlighting for

Re: Derelict SFML destructor crashes

2012-12-16 Thread Nekroze
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

Re: Derelict SFML destructor crashes

2012-12-16 Thread Nekroze
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

Re: Derelict SFML destructor crashes

2012-12-16 Thread Maxim Fomin
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

Re: Derelict SFML destructor crashes

2012-12-16 Thread Nekroze
On Sunday, 16 December 2012 at 17:14:55 UTC, Maxim Fomin wrote: 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

Re: Derelict SFML destructor crashes

2012-12-16 Thread Mike Parker
On Monday, 17 December 2012 at 04:40:39 UTC, Mike Parker wrote: First, please take all Derelict trouble-shooting problems to the Derelict forums[1]. I never check the sfml forums. I do check the newsgroups regularly, but these newsgroups are not generally the place to look for help with

Re: Derelict SFML destructor crashes

2012-12-16 Thread Mike Parker
First, please take all Derelict trouble-shooting problems to the Derelict forums[1]. I never check the sfml forums. I do check the newsgroups regularly, but these newsgroups are not generally the place to look for help with Derelict problems. Plus, by posting in other places, you are making it

Re: Derelict SFML destructor crashes

2012-12-16 Thread Nekroze
On Monday, 17 December 2012 at 04:42:49 UTC, Mike Parker wrote: On Monday, 17 December 2012 at 04:40:39 UTC, Mike Parker wrote: First, please take all Derelict trouble-shooting problems to the Derelict forums[1]. I never check the sfml forums. I do check the newsgroups regularly, but these

Re: Derelict SFML destructor crashes

2012-12-16 Thread Jacob Carlborg
On 2012-12-17 07:45, Nekroze wrote: So what i am getting here is that either A: having it in the destructor will work solong as the GC cleanup is called before the end of main because that is when sfml is unloaded OR B: I just have to have a manual destroy method in my class too to release the