[AD] destroy_bitmap after allegro_exit |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 02 Oct 2001, Laurence Withers <lwithers@xxxxxxxxxx> wrote:
> In reply to Charles Wardlaw <katt_gaiden@xxxxxxxxxx>:
> >
> >I also noticed that destroy_bitmap tends to crash if called after
> >allegro_exit.
...
> Known behaviour. The place it causes problems most frequently is in C++
> class destructors (particularly with global objects, which are always
> destroyed after Allegro is removed).
I never cared about this much, but now that it potentially affects me
;-) I'm wondering if we should try and get rid of this behaviour.
Looking in `destroy_bitmap', the reason for crashes seems to be:
/* normal memory or sub-bitmap destruction */
if (system_driver->destroy_bitmap) {
if (system_driver->destroy_bitmap(bitmap))
return;
}
AFAICT, *no* system driver implements that method. Is it used for
AllegroGL? If not, I'd like to remove those lines, and the system
driver methods for `create_bitmap' and `destroy_bitmap'.
That won't solve system bitmaps, video bitmaps, or sub-bitmaps.
But I think it's reasonable that they require explicit destruction.
I'm mainly thinking of languages with garbage collection, where
explicit destruction is out of place, but sometimes encouraged anyway,
e.g. closing files. (And, yes, the reason for this message is because
I want to GC memory bitmaps, which abound compared to the others.)
In `destroy_sample' there is a call to `stop_sample', which we could
just skip if `digi_driver' has disappeared.
I haven't looked at other types yet.