FIX: crash on MacOS when system logout, not really Close mainframe

Change-Id: I0e7cc73c1b4bbc663105034e82dcd7a51998e244
This commit is contained in:
chunmao.guo 2022-08-30 10:57:12 +08:00 committed by Lane.Wei
parent 8319ef604c
commit de712b08f1
3 changed files with 14 additions and 5 deletions

View file

@ -1836,7 +1836,16 @@ bool GUI_App::on_init_inner()
CBaseException::set_log_folder(data_dir());
#endif
wxGetApp().Bind(wxEVT_QUERY_END_SESSION, [](auto & e) {
wxGetApp().Bind(wxEVT_QUERY_END_SESSION, [this](auto & e) {
if (mainframe) {
wxCloseEvent e2(wxEVT_CLOSE_WINDOW);
e2.SetCanVeto(true);
mainframe->GetEventHandler()->ProcessEvent(e2);
if (e2.GetVeto()) {
e.Veto();
return;
}
}
for (auto d : dialogStack)
d->EndModal(1);
});