Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » an old bug still there

This thread is locked; no one can reply to it. rss feed Print
an old bug still there
Neil Walker
Member #210
April 2000
avatar

Hello,
I was hoping this bug might have been fixed in the latest 4.2 but it hasn't. I tried to figure it when I first posted it here a while ago, but couldn't.

Basically, if you create a system bitmap then create sub-bitmaps from it, when you destroy any of the sub-bitmaps, your program crashes. Video and memory bitmaps are fine.

I have only (and I guess it is the only o/s that supports them) tried this on Windows.

Anyone hazard a guess why, or if it's possible for someone to have a look :)

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Peter Wang
Member #23
April 2000

Please consider debugging this yourself. We are extremely short on Windows developers nowadays and need to encourage more users to become developers.

Matthew Leverton
Supreme Loser
January 1999
avatar

I'm unable to duplicate it on 4.2.1 with VC 2005.

relpatseht
Member #5,034
September 2004
avatar

Might I suggest (better) documentation of the driver functions and vtable functions if you want more users to become developers? While working on the DS port of Allegro, I often find myself either tracing through other drivers looking for a specific function or asking Tomasu when he is present just to find out what it is supposed to do. The functions which Allegro exposes to the user are documented well enough, but those exposed only to the developer could use a bit of work.

Not that I am willing or even capable of doing any of my suggestions, but I do believe they would at least help moderately in getting more users to participate in development.

Evert
Member #794
November 2000
avatar

I distinctly remember looking into this a long while back (any chance you can dig up the thread?) and finding a fix for it. I think this was comitted after testing as well, that should show up in the logs.

Matthew Leverton
Supreme Loser
January 1999
avatar

Peter Wang
Member #23
April 2000

Quote:

Might I suggest (better) documentation of the driver functions and vtable functions if you want more users to become developers?

You might, but it's not going to happen. Can I suggest in return that, while working on the DS port, adding any comments on anything you figure out? If and when we merge the DS port into the main tree, we would pick up those comments as well. Thanks.

Neil Walker
Member #210
April 2000
avatar

I can get it to fail with this simple program, can you try this Matthew? or anyone who would like to try it out, it crashes on the first destroy statement, both in mingw and vc2005 for me. Then uncomment/swap the two commented lines to make it normal memory bitmaps and all is well:

btw, I'm on 4.2.0.0 but I would have thought this would have the fix mentioned above in it also.

1#include <allegro.h>
2 
3int main()
4{
5 allegro_init();
6 install_keyboard();
7 install_timer();
8
9 set_color_depth(32);
10 if(set_gfx_mode(GFX_AUTODETECT_WINDOWED,640,480,0,0)!=0)
11 {
12 allegro_message("no gfx mode");
13 return 0;
14 }
15 
16 BITMAP* master=create_system_bitmap(200,200);
17 //BITMAP* master=create_bitmap(200,200);
18 if(!master)
19 {
20 allegro_message("no master");
21 return 0;
22 }
23 if(!is_system_bitmap(master))
24 //if(is_system_bitmap(master))
25 {
26 allegro_message("not a proper system bitmap, only a poor memory one");
27 return 0;
28 }
29 
30 clear_to_color(master,makecol(255,0,0));
31 
32 BITMAP* child1=create_sub_bitmap(master,0,0,64,64);
33 BITMAP* child2=create_sub_bitmap(master,64,64,64,64);
34 if(!child1 || !child2)
35 {
36 allegro_message("no children created");
37 return 0;
38 }
39 
40 blit(master,screen,0,0,0,0,master->w,master->h);
41 blit(child1,screen,0,0,500,0,child1->w,child1->h);
42 blit(child2,screen,0,0,500,100,child2->w,child2->h);
43 textout_ex(screen,font,"press ESCape and see if you die",0,400,makecol(255,255,255),0);
44 
45 while(!key[KEY_ESC])
46 rest(10);
47 
48 destroy_bitmap(child1); //kaboom
49 destroy_bitmap(child2);
50 destroy_bitmap(master);
51 return 1;
52}
53END_OF_MAIN()

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

relpatseht
Member #5,034
September 2004
avatar

Quote:

You might, but it's not going to happen. Can I suggest in return that, while working on the DS port, adding any comments on anything you figure out? If and when we merge the DS port into the main tree, we would pick up those comments as well.

If such is the case, then I will make no suggestion. I will, however, make the greatest effort I am willing to put forth, which if history serves as truth will be very little, to follow your's even in the event you don't make it.

Matthew Leverton
Supreme Loser
January 1999
avatar

Quote:

I can get it to fail with this simple program, can you try this Matthew? or anyone who would like to try it out, it crashes on the first destroy statement, both in mingw and vc2005 for me. Then uncomment/swap the two commented lines to make it normal memory bitmaps and all is well:

No crash on gcc or VC 2005.

Francois Lamini
Member #7,791
September 2006
avatar

I'd be glad to work on Allegro if I wasn't working on Mario's Fly Catcher. This library made it possible to persue my dreams. And what's sad is that after Mario's Fly Catcher I'll be working on Worm Wars so as you can see I'm quite busy.

Francois

Evert
Member #794
November 2000
avatar

Quote:

btw, I'm on 4.2.0.0

What's with the extra .0?
Anyway, when you say you're testing the latest version, you should actually use the latest version. Try 4.2.1 and see if that fixes it.

Quote:

but I would have thought this would have the fix mentioned above in it also.

How could it? 4.2.0 was released in November 2005, you reported the problem in January 2006.

Neil Walker
Member #210
April 2000
avatar

Quote:

What's with the extra .0?

I just copied/pasted from file properties in windows :)

Quote:

How could it? 4.2.0 was released in November 2005, you reported the problem in January 2006.

I guess I'm behind the times again, I thought I had updated. I'll get the latest copy and recompile.

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Richard Phipps
Member #1,632
November 2001
avatar

4.2.0 is over a year old already?!

Wow, time flies..

Neil Walker
Member #210
April 2000
avatar

4.2.1 fixes the subbitmap problem. apologies for the time-wasting :)

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Go to: