Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#16017 closed defect (fixed)

wxDataViewChoiceRenderer crashes when no choice is selected

Reported by: hartwigw Owned by: vadz
Priority: normal Milestone: 3.0.1
Component: wxOSX-Cocoa Version: dev-latest
Keywords: wxDataView wxDataViewChoiceRenderer Cc:
Blocked By: Blocking:
Patch: yes

Description

If no choice is selected - choice selection is aborted by clicking outside the choice selector - wxDataViewChoiceRenderer::OSXOnCellChanged's value contains -1. But wxDataViewChoiceRenderer::OSXOnCellChanged, respectively wxDataViewChoiceRenderer::GetChoice(size_t const), do not check against this special value and therefore the app crashes.

Attachments (1)

wxDataView_24.patch download (845 bytes) - added by hartwigw 5 months ago.

Download all attachments as: .zip

Change History (5)

Changed 5 months ago by hartwigw

comment:1 Changed 5 months ago by vadz

  • Milestone set to 3.0.1
  • Owner set to vadz
  • Status changed from new to accepted

I'd prefer to check for -1 explicitly and assert if the value is invalid, this would allow us to discover any future changes in behaviour in OS X easier (as apparently this has already changed from passing us a string to passing an index, who knows what will it become in the future). Do you see any problems with doing it like this?

Thanks!

comment:2 Changed 5 months ago by hartwigw

No, there should not be any problems.

Regards
Hartwig

comment:3 Changed 5 months ago by VZ

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [76045]) Don't crash in wxOSX wxDataViewChoiceRenderer if selection was cancelled.

Check for the index validity and ignore the value of -1 as it is passed if the
selection in the popup was cancelled.

Closes #16017.

comment:4 Changed 5 months ago by VZ

(In [76051]) Don't crash in wxOSX wxDataViewChoiceRenderer if selection was cancelled.

Check for the index validity and ignore the value of -1 as it is passed if the
selection in the popup was cancelled.

Closes #16017.

Note: See TracTickets for help on using tickets.