Ticket #14802 (closed defect: fixed)

Opened 7 months ago

Last modified 7 months ago

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: Patch: yes
Blocking:

Description

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

dvctl_current_row_fix.diff download (5.1 KB) - added by rk 7 months ago.

Change History

Changed 7 months ago by rk

Changed 7 months 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.

Changed 7 months ago by VZ

  • status changed from new to closed
  • resolution set to fixed

(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.