Fix error when clicking on empty space in wxDVC under Mac
Double clicking on empty space under the items in wxDataViewCtrl still results in actionDoubleClick: being called, even though there is no valid item under the mouse. Just ignore such notifications, as we're not supposed to generate any events in this case (neither GTK nor generic version do it) and calling itemAtRow: with invalid row results in errors due to invalid index use. Closes https://github.com/wxWidgets/wxWidgets/pull/2142 Closes #18984.
This commit is contained in:
@@ -1680,7 +1680,17 @@ outlineView:(NSOutlineView*)outlineView
|
||||
wxDataViewCtrl* const dvc = implementation->GetDataViewCtrl();
|
||||
wxDataViewModel * const model = dvc->GetModel();
|
||||
|
||||
const wxDataViewItem item = wxDataViewItemFromItem([self itemAtRow:[self clickedRow]]);
|
||||
const NSInteger row = [self clickedRow];
|
||||
if ( row == -1 )
|
||||
{
|
||||
// We can be called even when there is no item under mouse, e.g. when
|
||||
// clicking on empty space under the items. Just ignore such clicks as
|
||||
// we're not supposed to generate any events in this case (and calling
|
||||
// itemAtRow: below would result in errors when the row is invalid).
|
||||
return;
|
||||
}
|
||||
|
||||
const wxDataViewItem item = wxDataViewItemFromItem([self itemAtRow:row]);
|
||||
|
||||
const NSInteger col = [self clickedColumn];
|
||||
wxDataViewColumn* const dvCol = implementation->GetColumn(col);
|
||||
|
Reference in New Issue
Block a user