X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6bb81c8e1ae2f7a0acc2535ebdfa776512cfe26f..96c9640205933ad0673d5af2c96af0816c50160c:/src/msw/treectrl.cpp diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index f67589c3f7..37d21463a4 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -791,6 +791,8 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxTreeCtrl::~wxTreeCtrl() { + m_isBeingDeleted = true; + // delete any attributes if ( m_hasAnyAttr ) { @@ -3468,7 +3470,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // // to avoid such surprises, we force the generation of focus events // now, before we generate the selection change ones - if ( !m_changingSelection ) + if ( !m_changingSelection && !m_isBeingDeleted ) SetFocus(); break; @@ -3645,7 +3647,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) case NM_RCLICK: { TV_HITTESTINFO tvhti; - ::GetCursorPos(&tvhti.pt); + wxGetCursorPosMSW(&tvhti.pt); ::ScreenToClient(GetHwnd(), &tvhti.pt); if ( TreeView_HitTest(GetHwnd(), &tvhti) ) {