wxDataViewCtrl destructor ClearColumns causes a resort wxOSX-Cocoa
|Reported by:||johnr||Owned by:||VZ|
|Keywords:||wxDataViewCtrl destructor resort||Cc:||hartwigw|
dataview_osx.cpp destructor for wxDataViewCtrl calls ClearColumns() which in turn calls
In this function there is mention of a bug in NSOutlineView for OSX 10.5.6 and the workaround for this is to delete and then recreate the outlineview.
Recreating it calls
-(NSInteger) outlineView:(NSOutlineView*)outlineView numberOfChildrenOfItem:(id)item
which includes the line
if ([sortDescriptors count] > 0)
[children sortUsingFunction:CompareItems context:sortDescriptors];
If there are sortDescriptors then this causes a sort using
NSInteger CompareItems(id item1, id item2, void* context)
in the middle of destroying the wxDataViewCtrl with unexpected results.
I notice a problem when there are 2 wxDataViewCtrls in a notebook and one has had the column header clicked to sort the items.
Not re-creating the outlineView caused a crash so my work around was to call AssociateModel( NULL ) in my derived DataViewCtrl class. However, AssociateModel( NULL ) causes a crash in MSW presumably when wxDataViewCtrlBase::AssociateModel( NULL ) leaves an invalid wxDataViewCtrl::m_notifier which is private.
Probably sortDescriptors should be reset/deleted when clearing columns.
Change History (12)
Changed 2 years ago by johnr
comment:10 Changed 2 years ago by VZ
- Owner set to VZ
- Resolution set to fixed
- Status changed from new to closed