Re: [AD] Problem with remove_mouse() and video bitmaps. |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Evert Glebbeek wrote:
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 ?
As far as I can tell, I think he means something like
void destroy_bitmap(BITMAP *bmp)
{
/* do stuff */
...
bmp = NULL;
}
that is what i thought he meant, but wasn't sure, so i asked him to explain.
which obviously wouldn't do anything. Unless we're going to do specific
checks from within destroy_bitmap() to see wether or not the mouse is
displayed on that bitmap (ugh), the only thing we can do is to tell people
that the mouse muct be removed from the bitmap before it is destroyed.
Which does make some sense, let's be honest.
Adding specific mouse code to the destroy_bitmap() is not really an option.
Perhaps with much twisting of arm, a debug assert could be added, if
its not going to greatly impact the performace of destroy_bitmap().