Re: [AD] Problem with remove_mouse() and video bitmaps. |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: alleg-developers@xxxxxxxxxx
- Subject: Re: [AD] Problem with remove_mouse() and video bitmaps.
- From: Stef <stapostol@xxxxxxxxxx>
- Date: Fri, 30 Dec 2005 11:09:37 +0200
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:to:subject:references:message-id:date:from:content-type:mime-version:content-transfer-encoding:in-reply-to:user-agent; b=QLBtlV94ytosucvEhICRR0rN8y0pQnPe/d/HEFAvVCOeKAhpMRaBqGDmfnMKdTxRll6pgZeQs1yKc+O/rj9R9atugfCiacfg5XzgjJxXQXirK0CyVDJZfZnNcwdLep+KbuMtcwH/67k6i+thJTuYM+k0rN++rxy3YkbdMxgpD7k=
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.