Re: [AD] Problem with remove_mouse() and video bitmaps.

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Fri, 30 Dec 2005 10:55:02 +0200, aj <aj@xxxxxxxxxx> wrote:

Stef wrote:

On Fri, 30 Dec 2005 10:24:44 +0200, Peter Wang <tjaden@xxxxxxxxxx> wrote:

+ Note: you must not be showing a mouse pointer on a bitmap at the time that + the bitmap is destroyed with destroy_bitmap(). This does not apply to
+   `screen' since you never destroy `screen' with destroy_bitmap().


If the destroy_bitmap() function automatically nulled out the bitmap pointer, it would be trivial to add a check to avoid drawing onto an invalid bitmap. While this wouldn't be the end of this kind of problems, it would help allegro become more robust. It wouldn't break compatibility either (though programs using an old dll would be more crash prone).

Is there an obvious reason against this that I missed? (very probable). Otherwise, I think I could submit a patch for this one if the following days.


explain how that would work ?


I have a hunch that the crash is caused by the draw_mouse() function accessing the _mouse_screen bitmap (which in this case is invalid, since it is destroyed). If the destroy_bitmap function nulls automatically nulls out the bitmap pointer, the draw_mouse could check if the _mouse_screen exists, and do nothing if it doesn't. It would be better though if we had a bitmap_exists() function, though it is out of the question now.

For the moment, this is only a theory. I'll try to test is today.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/