X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7da60d7c18d4b7a9ed586208cc6174b87b55db91..3d63970769b32a93061989a38a00a5b6110bc7a5:/src/msw/listctrl.cpp diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 4347b84820..25c10a2929 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -113,16 +113,16 @@ public: m_pItem = &item; } - // memcpy() in Init() can't work if the struct sizes are different - wxCOMPILE_TIME_ASSERT( sizeof(LV_ITEM_OTHER) == sizeof(LV_ITEM_NATIVE), - CodeCantWorkIfDiffSizes); - // init with conversion void Init(LV_ITEM_OTHER& item) { // avoid unnecessary dynamic memory allocation, jjust make m_pItem // point to our own m_item + // memcpy() can't work if the struct sizes are different + wxCOMPILE_TIME_ASSERT( sizeof(LV_ITEM_OTHER) == sizeof(LV_ITEM_NATIVE), + CodeCantWorkIfDiffSizes); + memcpy(&m_item, &item, sizeof(LV_ITEM_NATIVE)); // convert text from ANSI to Unicod if necessary @@ -480,6 +480,8 @@ void wxListCtrl::FreeAllInternalData() m_ignoreChangeMessages = false; m_AnyInternalData = false; + + m_count = 0; } } @@ -1230,7 +1232,7 @@ bool wxListCtrl::DeleteItem(long item) return false; } - m_count -= 1; + m_count--; wxASSERT_MSG( m_count == ListView_GetItemCount(GetHwnd()), wxT("m_count should match ListView_GetItemCount")); @@ -1816,7 +1818,8 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // ignored for efficiency. It is done here because the internal data is in the // process of being deleted so we don't want to try and access it below. if ( m_ignoreChangeMessages && - ( (nmLV->hdr.code == LVN_ITEMCHANGED) || (nmLV->hdr.code == LVN_ITEMCHANGING))) + ( (nmLV->hdr.code == LVN_ITEMCHANGED) || + (nmLV->hdr.code == LVN_ITEMCHANGING)) ) { return true; } @@ -1917,7 +1920,6 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) break; case LVN_DELETEALLITEMS: - m_count = 0; eventType = wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS; event.m_itemIndex = -1; break;