- if(!dest && !ds){
- if(was_bottom && !was_stdisp && ws->managed_stdisp==NULL){
- /* We should probably be managing any stdisp, that 'bottom'
- * was managing.
- */
- WMPlex *mplex=OBJ_CAST(REGION_MANAGER(ws), WMPlex);
-
- if(mplex!=NULL
- && mplex->mx_current!=NULL
- && mplex->mx_current->st->reg==(WRegion*)ws){
- mplex_remanage_stdisp(mplex);
- }
- }
-
- if(cur){
- /* This may still potentially cause problems when focus
- * change is pending. Perhaps we should use region_await_focus,
- * if it is pointing to our child (and region_may_control_focus
- * fail if it is pointing somewhere else).
- */
- WStacking *stf=find_to_focus(ws, next_st, TRUE);
- if(stf!=NULL && mcf){
- region_maybewarp_now(stf->reg, FALSE);
- }else{
- ws->current_managed=stf;
- }
+ if(!OBJ_IS_BEING_DESTROYED(ws) && was_current){
+ /* This may still potentially cause problems when focus
+ * change is pending. Perhaps we should use region_await_focus,
+ * if it is pointing to our child (and region_may_control_focus
+ * fail if it is pointing somewhere else).
+ */
+ WStacking *stf=find_to_focus(ws, next_st, TRUE);
+ if(stf!=NULL && mcf){
+ region_maybewarp_now(stf->reg, FALSE);
+ }else{
+ ws->current_managed=stf;