FIX: protect the EndModal functions while top dialog is not this one.

jira: [STUDIO-11503] [STUDIO-11522]
Change-Id: I02bf784fa7c796a75525deb79f8287027780bc69
This commit is contained in:
xin.zhang 2025-04-22 14:22:00 +08:00 committed by lane.wei
parent d73d45d892
commit d74a9ac286

View File

@ -7,6 +7,7 @@
#include <functional>
#include <boost/optional.hpp>
#include <boost/log/trivial.hpp>
#include <wx/frame.h>
#include <wx/dialog.h>
@ -337,7 +338,26 @@ private:
};
typedef DPIAware<wxFrame> DPIFrame;
typedef DPIAware<wxDialog> DPIDialog;
class DPIDialog : public DPIAware<wxDialog>
{
public:
using DPIAware<wxDialog>::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