call Show(false) from ~wxDialog to call EndModal if the dialog is still modal consistently in all ports
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51562 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -31,7 +31,7 @@ public:
|
|||||||
const wxSize &size = wxDefaultSize,
|
const wxSize &size = wxDefaultSize,
|
||||||
long style = wxDEFAULT_DIALOG_STYLE,
|
long style = wxDEFAULT_DIALOG_STYLE,
|
||||||
const wxString &name = wxDialogNameStr );
|
const wxString &name = wxDialogNameStr );
|
||||||
virtual ~wxDialog() {}
|
virtual ~wxDialog();
|
||||||
|
|
||||||
virtual bool Show( bool show = TRUE );
|
virtual bool Show( bool show = TRUE );
|
||||||
virtual int ShowModal();
|
virtual int ShowModal();
|
||||||
|
@@ -71,11 +71,20 @@ bool wxDialog::Show( bool show )
|
|||||||
|
|
||||||
bool ret = wxWindow::Show( show );
|
bool ret = wxWindow::Show( show );
|
||||||
|
|
||||||
if (show) InitDialog();
|
if (show)
|
||||||
|
InitDialog();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxDialog::~wxDialog()
|
||||||
|
{
|
||||||
|
m_isBeingDeleted = true;
|
||||||
|
|
||||||
|
// if the dialog is modal, this will end its event loop
|
||||||
|
Show(false);
|
||||||
|
}
|
||||||
|
|
||||||
bool wxDialog::IsModal() const
|
bool wxDialog::IsModal() const
|
||||||
{
|
{
|
||||||
return m_modalShowing;
|
return m_modalShowing;
|
||||||
|
@@ -77,6 +77,8 @@ void wxDialog::SetModal( bool flag )
|
|||||||
wxDialog::~wxDialog()
|
wxDialog::~wxDialog()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
m_isBeingDeleted = true;
|
||||||
|
|
||||||
|
// if the dialog is modal, this will end its event loop
|
||||||
Show(false);
|
Show(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -183,6 +183,9 @@ wxDialog::~wxDialog()
|
|||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
m_isBeingDeleted = true;
|
||||||
|
|
||||||
|
// if the dialog is modal, this will end its event loop
|
||||||
|
Show(false);
|
||||||
|
|
||||||
delete m_eventLoop;
|
delete m_eventLoop;
|
||||||
|
|
||||||
if (m_mainWidget)
|
if (m_mainWidget)
|
||||||
@@ -241,6 +244,9 @@ bool wxDialog::Show( bool show )
|
|||||||
if( !wxWindowBase::Show( show ) )
|
if( !wxWindowBase::Show( show ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if ( !show && IsModal() )
|
||||||
|
EndModal(wxID_CANCEL);
|
||||||
|
|
||||||
m_isShown = show;
|
m_isShown = show;
|
||||||
|
|
||||||
if (show)
|
if (show)
|
||||||
|
@@ -53,6 +53,11 @@ void wxDialog::Init()
|
|||||||
|
|
||||||
wxDialog::~wxDialog()
|
wxDialog::~wxDialog()
|
||||||
{
|
{
|
||||||
|
m_isBeingDeleted = true;
|
||||||
|
|
||||||
|
// if the dialog is modal, this will end its event loop
|
||||||
|
Show(false);
|
||||||
|
|
||||||
delete m_eventLoop;
|
delete m_eventLoop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user