From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Thu, 5 Jan 2012 12:51:40 +0000 (+0000)
Subject: Don't fill wxListEvent::m_item when using virtual list control in wxMSW.
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/8c62f53ee29a62db198a5250e79e3b2ea9d865e8

Don't fill wxListEvent::m_item when using virtual list control in wxMSW.

When using virtual list control the main program already has the items data so
it's completely useless to call GetItem() when preparing an event for it. It
is also inefficient to call GetItem() for potentially many items.

For both of these reasons the generic version already didn't fill the item
contents for virtual list controls events. Now modify wxMSW to not do it
neither.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70271 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp
index 5bc5c08c56..6c29d0ea06 100644
--- a/src/msw/listctrl.cpp
+++ b/src/msw/listctrl.cpp
@@ -2528,7 +2528,11 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
 
     // fill in the item before passing it to the event handler if we do have a
     // valid item index and haven't filled it yet (e.g. for LVN_ITEMCHANGED)
-    if ( event.m_itemIndex != -1 && !event.m_item.GetMask() )
+    // and we're not using a virtual control as in this case the program
+    // already has the data anyhow and we don't want to call GetItem() for
+    // potentially many items
+    if ( event.m_itemIndex != -1 && !event.m_item.GetMask()
+            && !IsVirtual() )
     {
         wxListItem& item = event.m_item;