*/
wxCFRef& operator=(const wxCFRef& otherRef)
{
- wxCFRetain(otherRef.m_ptr);
- wxCFRelease(m_ptr);
- m_ptr = otherRef.m_ptr;
+ if (this != &otherRef)
+ {
+ wxCFRetain(otherRef.m_ptr);
+ wxCFRelease(m_ptr);
+ m_ptr = otherRef.m_ptr;
+ }
return *this;
}
wxCFRelease(m_ptr);
m_ptr = p; // Automatic conversion should occur
}
+
+ // Release the pointer, i.e. give up its ownership.
+ refType release()
+ {
+ refType p = m_ptr;
+ m_ptr = NULL;
+ return p;
+ }
+
protected:
/*! @var m_ptr The raw pointer.
*/