]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/treectrl.cpp
applied patch 403988 (fixing MDI window menu)
[wxWidgets.git] / src / msw / treectrl.cpp
index 58a84c5ac46c20ad8d0456a19a05b8f24b4a2b46..a480a3d7e62b359f57dcab2fd96da34bdf2e7ded 100644 (file)
@@ -88,6 +88,7 @@
 // looks quite ugly.
 #define wxUSE_CHECKBOXES_IN_MULTI_SEL_TREE 0
 
+
 // ----------------------------------------------------------------------------
 // private functions
 // ----------------------------------------------------------------------------
@@ -1596,6 +1597,14 @@ void wxTreeCtrl::DeleteTextCtrl()
 {
     if ( m_textCtrl )
     {
+        // the HWND corresponding to this control is deleted by the tree
+        // control itself and we don't know when exactly this happens, so check
+        // if the window still exists before calling UnsubclassWin()
+        if ( !::IsWindow(GetHwndOf(m_textCtrl)) )
+        {
+            m_textCtrl->SetHWND(0);
+        }
+
         m_textCtrl->UnsubclassWin();
         m_textCtrl->SetHWND(0);
         delete m_textCtrl;