Add wxItemContainer::DetachClientObject() and use it in wxRearrangeList.

Add a method to detach the item from an item control without deleting it and
use it in wxRearrangeList to correctly swap object client data without
deleting the pointers in the process.

Closes #12201.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65040 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-07-22 12:09:15 +00:00
parent 9b481f66e5
commit ab9893576c
4 changed files with 52 additions and 6 deletions

View File

@@ -150,8 +150,8 @@ void wxRearrangeList::Swap(int pos1, int pos2)
case wxClientData_Object:
{
wxClientData * const dataTmp = GetClientObject(pos1);
SetClientObject(pos1, GetClientObject(pos2));
wxClientData * const dataTmp = DetachClientObject(pos1);
SetClientObject(pos1, DetachClientObject(pos2));
SetClientObject(pos2, dataTmp);
}
break;