There are two choices for you if you want to ptr_remove a panel :
1 - ptr_remove the BMAP before the PANEL : You MUST set the PANEL's bmap pointer to NULL before removing the BMAP.
2 - ptr_remove the PANEL before the BMAP : You MUST have another pointer that points to the BMAP (You can get the PANEL bmap pointer just before releasing it).