Hello.
I actually have a problem with a program I'm writing in C++. No problem to compile but at execution, it crashes (Segmentation Fault) at the end of execution.
The code of this early program is at this adress (another forum for allegro)(I didn't manage to upload the files here):
http://www.developpez.net/forums/showthread.php?p=1539606#post1539606
(DangerousBowlOfJelly is my pseudo on this forum)
My environnement : WinXP + Code::Blocks 1.0 + MinGW32.
Any help would be nice.
Thanks
Il.
]]>I looked at the French instructions, didn't understand, saw the zip link, clicked on that and (I guess) was asked for a name and password. I gave up.
But anyway, my guess is that you're allocating stuff twice without destroying the first thing, so when you exit it's trying to free() stuff that's already been freed.
Maybe BITMAP *bmp = load_bitmap("mypic.bmp",0) then bmp = load_bitmap("hispic.bmp",0) without a destroy_bitmap(bmp). Or something like that, I don't do C++.
I've managed to upload them on a web page. See :
http://pierre.devasselot.free.fr/prog/
The .zip archive brings all files in this folder together
No password needed
and (I guess) was asked for a name and password
I see what happened. I was logged when I checked the link. I didn't know a account was required to download atattachment
my guess is that you're allocating stuff twice without destroying the first thing
I'll check that. Thanks for the hint.
Il.
]]>Hello,
I haven't checked the code fully, but whenever you work with stuff you create on the heap you should always initialise them to NULL to begin with and when you delete them check they exist,
e.g.
BITMAP* page1=NULL;
...
if(page1) destroy_bitmap(page1);
Also,
I noticed you are destroying bitmaps and making allegro calls in your destructors. Are you sure than these are being called before you exit allegro?
you should always initialise them to NULL to begin with
It's done in the contructors
Are you sure than these are being called before you exit allegro
I'm not sure but I suppose so, because I call 'delete item' in the destructor of the 'Moteur' object. I suppose 'moteur' object is deleted at the end of main, before exiting allegro.
when you delete them check they exist
I do it now, but it doesn't change anything.
Il.
]]>Finally, my menu works well. I didn't have enough control structures to check if pointers were well destroyed. For thoses who might want to have a menu like mine, I release source code for it.
It dispays a first window 300x400 with a few options, highlighted when draggong mouse on them, then when selecting 'nouveau', it goes to another window 800x600. When whe click in that window, we go back to the menu. It doesn't go anywhere if we click anywhere in the menu window except on options.
You cad download source code at this adress :
http://pierre.devasselot.free.fr/prog
no login, no password
You can use it as you want.
Il.
]]>