From c546974fbfc7b361c58105ca48ab3712bef7ed06 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sun, 1 Jun 2003 20:12:30 +0000 Subject: [PATCH] Fixed bug [ 743664 ] wxListCtrl asserts when deleting its m_textCtrl git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20838 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/listctrl.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 02cbeb0947..4d906a5c85 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -1841,7 +1841,19 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxConvertFromMSWListItem(NULL, event.m_item, item); if ( ((LV_ITEM)item).pszText == NULL || ((LV_ITEM)item).iItem == -1 ) + { + // don't keep a stale wxTextCtrl around + if ( m_textCtrl ) + { + // EDIT control will be deleted by the list control itself so + // prevent us from deleting it as well + m_textCtrl->UnsubclassWin(); + m_textCtrl->SetHWND(0); + delete m_textCtrl; + m_textCtrl = NULL; + } return FALSE; + } event.m_itemIndex = event.m_item.m_itemId; } @@ -1853,7 +1865,19 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wxConvertFromMSWListItem(NULL, event.m_item, item); if ( ((LV_ITEM)item).pszText == NULL || ((LV_ITEM)item).iItem == -1 ) + { + // don't keep a stale wxTextCtrl around + if ( m_textCtrl ) + { + // EDIT control will be deleted by the list control itself so + // prevent us from deleting it as well + m_textCtrl->UnsubclassWin(); + m_textCtrl->SetHWND(0); + delete m_textCtrl; + m_textCtrl = NULL; + } return FALSE; + } event.m_itemIndex = event.m_item.m_itemId; }