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;
}
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;
}
eventType = wxEVT_COMMAND_LIST_CACHE_HINT;
- // we get some really stupid cache hints like ones for items in
- // range 0..0 for an empty control or, after deleting an item,
- // for items in invalid range - filter this garbage out
- if ( cacheHint->iFrom < cacheHint->iTo )
- {
- event.m_oldItemIndex = cacheHint->iFrom;
-
- long iMax = GetItemCount();
- event.m_itemIndex = cacheHint->iTo < iMax ? cacheHint->iTo
- : iMax - 1;
- }
- else
- {
+ // we get some really stupid cache hints like ones for
+ // items in range 0..0 for an empty control or, after
+ // deleting an item, for items in invalid range -- filter
+ // this garbage out
+ if ( cacheHint->iFrom > cacheHint->iTo )
return FALSE;
- }
+
+ event.m_oldItemIndex = cacheHint->iFrom;
+
+ const long iMax = GetItemCount();
+ event.m_itemIndex = cacheHint->iTo < iMax ? cacheHint->iTo
+ : iMax - 1;
}
break;