]> git.saurik.com Git - wxWidgets.git/commitdiff
fix a problem with (sometimes) editing an invalid item in EditLabel() (Tim Kosse)
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 4 Dec 2006 17:07:57 +0000 (17:07 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 4 Dec 2006 17:07:57 +0000 (17:07 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43805 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/listctrl.cpp

index 96469862955d4414b1013dbecb0d954507a3e264..a7485c2a2e1561065639a121c27a8dbf0d08ed5a 100644 (file)
@@ -2910,8 +2910,15 @@ wxTextCtrl *wxListMainWindow::EditLabel(long item, wxClassInfo* textControlClass
     // We have to call this here because the label in question might just have
     // been added and no screen update taken place.
     if ( m_dirty )
+    {
         wxSafeYield();
 
+        // Pending events dispatched by wxSafeYield might have changed the item
+        // count
+        if ( (size_t)item >= GetItemCount() )
+            return NULL;
+    }
+
     wxTextCtrl * const text = (wxTextCtrl *)textControlClass->CreateObject();
     m_textctrlWrapper = new wxListTextCtrlWrapper(this, text, item);
     return m_textctrlWrapper->GetText();