diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index b81a0b4f09..870f0ded05 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -515,6 +515,13 @@ void wxTreeTextCtrl::Finish( bool setfocus ) { m_owner->ResetTextControl(); +#ifdef __WXMAC__ + // On wxMac, modal event loops avoid deleting pending objects. + // Hide control so it does not remain visible e.g. if the tree + // control is used in a dialog. + Hide(); +#endif + wxPendingDelete.Append(this); if (setfocus)