Add wxObjectDataPtr::release()

This makes it possible to use wxObjectDataPtr inside functions returning
raw pointers owned by the caller, such as custom GetAttr() in the grid
sample.
This commit is contained in:
Vadim Zeitlin
2020-03-31 02:43:15 +02:00
parent 15b5a1865c
commit 06af121e9c
4 changed files with 28 additions and 14 deletions

View File

@@ -313,6 +313,13 @@ public:
m_ptr = ptr;
}
T* release()
{
T* const ptr = m_ptr;
m_ptr = NULL;
return ptr;
}
wxObjectDataPtr& operator=(const wxObjectDataPtr &tocopy)
{
if (m_ptr)