FIX: crash on MacOS when system logout, not really Close mainframe
Change-Id: I0e7cc73c1b4bbc663105034e82dcd7a51998e244
This commit is contained in:
parent
8319ef604c
commit
de712b08f1
|
@ -1836,7 +1836,16 @@ bool GUI_App::on_init_inner()
|
||||||
CBaseException::set_log_folder(data_dir());
|
CBaseException::set_log_folder(data_dir());
|
||||||
#endif
|
#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)
|
for (auto d : dialogStack)
|
||||||
d->EndModal(1);
|
d->EndModal(1);
|
||||||
});
|
});
|
||||||
|
|
|
@ -469,7 +469,7 @@ bool generate_image(const std::string &filename, wxImage &image, wxSize img_size
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<wxDialog*> dialogStack;
|
std::deque<wxDialog*> dialogStack;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ struct DpiChangedEvent : public wxEvent {
|
||||||
wxDECLARE_EVENT(EVT_DPI_CHANGED_SLICER, DpiChangedEvent);
|
wxDECLARE_EVENT(EVT_DPI_CHANGED_SLICER, DpiChangedEvent);
|
||||||
#endif // !wxVERSION_EQUAL_OR_GREATER_THAN
|
#endif // !wxVERSION_EQUAL_OR_GREATER_THAN
|
||||||
|
|
||||||
extern std::vector<wxDialog*> dialogStack;
|
extern std::deque<wxDialog*> dialogStack;
|
||||||
|
|
||||||
template<class P> class DPIAware : public P
|
template<class P> class DPIAware : public P
|
||||||
{
|
{
|
||||||
|
@ -226,9 +226,9 @@ public:
|
||||||
|
|
||||||
int ShowModal()
|
int ShowModal()
|
||||||
{
|
{
|
||||||
dialogStack.push_back(this);
|
dialogStack.push_front(this);
|
||||||
int r = wxDialog::ShowModal();
|
int r = wxDialog::ShowModal();
|
||||||
dialogStack.pop_back();
|
dialogStack.pop_front();
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue