Opened 5 years ago

Closed 5 years ago

#14802 closed defect (fixed)

wxDVC crashes after removing items and trying to navigate with the keyboard

Reported by: rk Owned by:
Priority: normal Milestone:
Component: GUI-generic Version:
Keywords: Cc:
Blocked By: Blocking:
Patch: yes


This can be seen in the dataview sample.

  • open dataview sample
  • select the "Classical music" node
  • delete the node using the keyboard *not* the "Delete selected" button
  • press cursor right
  • crash!

The reason for this is that the 'current' item of the tree is not updated properly if items are deleted. The actual crash happens because we try to expand a tree node that no longer exists.

The attached patch fixes this by making sure that m_currentRow is updated properly and always stays inside its allowed boundaries.

Attachments (1)

dvctl_current_row_fix.diff download (5.1 KB) - added by rk 5 years ago.

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by rk

comment:1 Changed 5 years ago by vadz

I don't really like the idea of silently returning NULL for invalid row in GetTreeNodeByRow(), I think it would be better to avoid calling it with such row index in the first place. But this is definitely better than crashing, so I'll apply the patch for now, thanks!

Still, if you could streamline this a bit more and notably document (in the comments) what are the pre- and post-conditions for the different functions involved, it would be great.

comment:2 Changed 5 years ago by VZ

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

(In [72906]) Update the current row after item deletion in generic wxDataViewCtrl.

Also change the code changing the current item to collect the range checks
inside OnVerticalNavigation() itself instead of doing them in the caller.

Closes #14802.

Note: See TracTickets for help on using tickets.