Simplify code using wxDataViewCtrl::m_Deleting in wxOSX
Use a RAII-based helper class to reset this flag automatically on scope exit instead of doing it manually. This also ensures that we restore the original value rather than just resetting it which would be more correct in the (admittedly, very unlikely) case when any of the functions changing m_Deleting is called recursively.
This commit is contained in:
@@ -259,11 +259,6 @@ public:
|
||||
{
|
||||
m_CustomRendererPtr = NewCustomRendererPtr;
|
||||
}
|
||||
// sets the flag indicating a deletion process:
|
||||
void SetDeleting(bool deleting)
|
||||
{
|
||||
m_Deleting = deleting;
|
||||
}
|
||||
|
||||
void AdjustAutosizedColumns() const;
|
||||
|
||||
@@ -305,6 +300,9 @@ private:
|
||||
// after the actual deletion of the item; then, native callback functions/delegates may try to update data of variables that are already deleted;
|
||||
// if this flag is set all native variable update requests will be ignored
|
||||
|
||||
// This class can set (and reset) m_Deleting.
|
||||
friend class wxOSXDVCScopedDeleter;
|
||||
|
||||
void* m_cgContext; // pointer to core graphics context
|
||||
|
||||
wxDataViewCustomRenderer* m_CustomRendererPtr; // pointer to a valid custom renderer while editing; this class does NOT own the pointer
|
||||
|
||||
Reference in New Issue
Block a user