X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6fef2483d9dc1a7c006d2f5967791e0f4c0cf518..af1f44f17ea894ffba100703360b9084fb4fa17b:/src/generic/listctrl.cpp diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 9646986295..a7485c2a2e 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -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();