Re: [AD] Problem with remove_mouse() and video bitmaps. |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 2005-12-30, Stef <stapostol@xxxxxxxxxx> wrote:
> I was in hurry so I did not explain myself enough. Let me explain what I
> meant:
>
> As far as I can tell, the problem is that the draw_mouse() function
> (called by the show_mouse()) tries to draw the mouse pointer to a
> non-valid bitmap (one that has been deallocated). If we had a way to tell
> whether a bitmap is valid, draw_mouse() could bail out without crashing.
There is no reasonable way to do that, other than the way we are trying
to avoid.
> Since we don't have a bitmap_exists() function (and for compatibilty
> reasons can't add one now),
It implies a global data structure with links to every single bitmap
allocated. Traversing this for every mouse cursor update would not be
nice. Moreover it would not strictly be correct since you might destroy
a bitmap with address A, then allocate a new bitmap with exactly the
same address A before the draw_mouse() function is called again.
> we could at least place a check against NULL
> in draw_mouse().
That requires checking if a bitmap being destroyed by destroy_bitmap()
has a mouse cursor shown on it and setting a pointer to NULL if that is
so.
Peter