diff --git a/src/slic3r/GUI/GUI_Utils.hpp b/src/slic3r/GUI/GUI_Utils.hpp index 8d9f89d48..d008b850a 100644 --- a/src/slic3r/GUI/GUI_Utils.hpp +++ b/src/slic3r/GUI/GUI_Utils.hpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -337,7 +338,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