diff --git a/src/slic3r/GUI/GUI_Utils.hpp b/src/slic3r/GUI/GUI_Utils.hpp index 366a3a61ad..e831d51315 100644 --- a/src/slic3r/GUI/GUI_Utils.hpp +++ b/src/slic3r/GUI/GUI_Utils.hpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -320,7 +321,26 @@ private: }; typedef DPIAware DPIFrame; -typedef DPIAware DPIDialog; +class DPIDialog : public DPIAware +{ +public: + using DPIAware::DPIAware; + +public: + void EndModal(int retCode) override + { + if (!dialogStack.empty() && dialogStack.front() != this) { + // This is a bug in wxWidgets + // when the dialog is not top modal dialog, EndModal() just hide dialog without quit + // the modal event loop. And the modal event loop blocks us from bottom widgets. + // Solution: let user click it manually or close outside. FIXME + BOOST_LOG_TRIVIAL(warning) << "DPIAware::EndModal Error: dialogStack is not empty, but top dialog is not this one. retCode=" << retCode; + return; + } + + return wxDialog::EndModal(retCode); + } +}; class EventGuard