Delegate UI_DIALOG deletion back to window_close

UI_DIALOG::event_handler's case `EVENT_WINDOW_CLOSE` can only be hit if
`rval == window_event_result::ignored`.  Any other result returned
before entering the switch.  If `rval == ignored`, then returning
`ignored` will cause `window_close` to delete the object.  Delegate to
that deletion instead of having an explicit deletion in this handler.
This commit is contained in:
Kp 2023-01-29 20:42:03 +00:00
parent 031a4b166c
commit 385d51b18e

View file

@ -95,10 +95,6 @@ window_event_result UI_DIALOG::event_handler(const d_event &event)
return rval;
}
case EVENT_WINDOW_CLOSE:
if (rval != window_event_result::deleted) // check if handler already deleted dialog (e.g. if UI_DIALOG was subclassed)
delete this;
return window_event_result::deleted; // free the window in any case (until UI_DIALOG is subclass of window)
default:
return window_event_result::ignored;
}