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:
@@ -191,6 +191,18 @@ wxClientData *wxItemContainer::GetClientObject(unsigned int n) const
|
||||
return static_cast<wxClientData *>(DoGetItemClientData(n));
|
||||
}
|
||||
|
||||
wxClientData *wxItemContainer::DetachClientObject(unsigned int n)
|
||||
{
|
||||
wxClientData * const data = GetClientObject(n);
|
||||
if ( data )
|
||||
{
|
||||
// reset the pointer as we don't own it any more
|
||||
DoSetItemClientData(n, NULL);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void wxItemContainer::SetClientData(unsigned int n, void *data)
|
||||
{
|
||||
if ( !HasClientData() )
|
||||
|
||||
Reference in New Issue
Block a user