removing a different panel that shares a bitmap [...]
ptr_remove just releases the memory of the panel and all its bitmaps.
Hmm what does that mean exactly when we look at the following cases:
=== CASE 1 ===
BMAP* compass_map = "compass.pcx";
PANEL* aircraft_pan =
{
bmap = compass_map; // compass_map as panel background
flags = SHOW;
}
=== CASE 2 ===
Same as in 1 but bmap pointer (globally or locally created) dynamically assigned - most likely the same?
=== CASE 3 ===
PANEL* splashscreen = { bmap = "splash.pcx"; } // creates a bmap splash_pcx
=== CASE 4 ===
PANEL* pnlDynamic = pan_create("...");
no panel background bmap
pan_setwindow(pnlDynamic, ...,BMAPPOINTER,...);
In which of those 4 cases are bitmaps being freed?
EDIT:
It's clear that when you use a local panel pointer, and something happens to that panel while the function is still running, it will crash.
I do not understand what this means, can you rephrase that sentence please?
In Turrican's situation the panel is created locally inside the function, not used in or "exposed" to any other function. Yet it crashes on removal. (EDIT2: Panel confirmed to be still in the C_LINK list before ptr_remove.)