Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CustomCellHandler to check if the cell is not null when handling mouse click #2387

Conversation

sergey-me
Copy link

Update CustomCellHandler to check if the cell content handler is connected to a cell when handling mouse click.

Otherwise, a null reference exception might get thrown when the user clicks too fast on a cell.

In the following scenario we can get a content that is not connected to a cell:

  • a tree has logic expanding/collapsing items on a cell double-click;
  • the user clicks too fast on a cell;
  • double-click causes the row expanding/collapsing;
  • the third click (e.ClickCount > 2) happens when the cells presenter is refreshed;
  • at this moment the cell content is disconnected from any cell (ctl?.GetVisualParent<swc.DataGridCell>() returns null).

…ected to a cell when handling mouse click.

Otherwise, a null reference exception might get thrown when the user clicks too fast on a cell.

In the following scenario we can get a content that is not connected to a cell:
 - a tree has logic expanding/collapsing items on a cell double-click;
 - the user clicks too fast on a cell;
 - double-click causes the row expanding/collapsing;
 - the third click (e.ClickCount > 2) happens when the cells presenter is refreshed;
 - at this moment the cell content is disconnected from any cell (ctl?.GetVisualParent<swc.DataGridCell>() returns null).
@cwensley cwensley added the bug label Feb 10, 2023
@cwensley cwensley added this to the 2.7.4 milestone Feb 10, 2023
@cwensley
Copy link
Member

Hey @sergey-me, thanks for submitting the fix and especially providing a use case that replicates it! Very much appreciated.

@cwensley cwensley merged commit 1345a4c into picoe:develop Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants