X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5cb3a695e0f65d71fe0c315766e0d6dafd4c312a..17d98558b35b75e3cad68d96841b4fa5a0c7e6ee:/src/msw/treectrl.cpp diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 9464bec90b..58daae2cf1 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -2029,8 +2029,7 @@ void wxTreeCtrl::DeleteTextCtrl() m_textCtrl->UnsubclassWin(); m_textCtrl->SetHWND(0); - delete m_textCtrl; - m_textCtrl = NULL; + wxDELETE(m_textCtrl); m_idEdited.Unset(); } @@ -2051,8 +2050,7 @@ wxTextCtrl *wxTreeCtrl::EditLabel(const wxTreeItemId& item, // returned false if ( !hWnd ) { - delete m_textCtrl; - m_textCtrl = NULL; + wxDELETE(m_textCtrl); return NULL; } @@ -2137,6 +2135,8 @@ void wxTreeCtrl::ClearFocusedItem() void wxTreeCtrl::SetFocusedItem(const wxTreeItemId& item) { + wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); + TempSetter set(m_changingSelection); ::SetFocus(GetHwnd(), HITEM(item)); @@ -3132,8 +3132,7 @@ wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) if ( m_dragImage ) { m_dragImage->EndDrag(); - delete m_dragImage; - m_dragImage = NULL; + wxDELETE(m_dragImage); // generate the drag end event wxTreeEvent event(wxEVT_COMMAND_TREE_END_DRAG, @@ -3273,8 +3272,7 @@ wxTreeCtrl::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) if ( m_dragImage ) { m_dragImage->EndDrag(); - delete m_dragImage; - m_dragImage = NULL; + wxDELETE(m_dragImage); // if we don't do it, the tree seems to think that 2 items // are selected simultaneously which is quite weird