Bug 456602 - [Cocoa] ArrayIndexOutOfBoundsException in Table._getItem

The problem is that item for cached `selectedRowIndex` can be deleted
between mouse down (where variable is set) and mouse up (where it's used).

I tried to solve the original problem (where macOS sends SWT.Selection
after `[NSEvent doubleClickInterval]` from mouse down) but didn't find a
way to do that. It seems that there are no settings that could disable
double click detection in `-[NSTableView mouseDown:]`. So the workaround
has to stay, it seems.

I also noticed that macOS cancels pending selection event in
`-[NSTableView noteNumberOfRowsChanged]`. SWT already calls that
whenever number of items changes (item is deleted or added). I was
thinking to reset `selectedRowIndex` in it, but then I wasn't sure
if it's the right thing to do if for example an item is added at the
end - surely this doesn't prevent from proceeding with handling click
on the old item? I the end, I decided to not overcomplicate things and
just fix the crash without affecting anything else.

Change-Id: I42cb381d408d105e4df6372a2d69967b9b274a9a
Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/192115
Tested-by: Platform Bot <platform-bot@eclipse.org>
Tested-by: Lakshmi P Shanmugam <lshanmug@in.ibm.com>
Reviewed-by: Lakshmi P Shanmugam <lshanmug@in.ibm.com>
3 files changed
tree: 11b881d314aececf3058ef69e68a987794ad5952
  1. bundles/
  2. container/
  3. examples/
  4. features/
  5. local-build/
  6. tests/
  7. .gitattributes
  8. .gitignore
  10. Jenkinsfile
  12. NOTICE
  13. pom.xml
  14. README.md

Contributing to SWT

Thanks for your interest in this project.

Developer resources:

See the following description for how to contribute a feature or a bug fix to SWT.

Information regarding source code management, builds, coding standards, and more and be found under the following link.

Contributor License Agreement:

Before your contribution can be accepted by the project, you need to create and electronically sign the Eclipse Foundation Contributor License Agreement (CLA).


Contact the project developers via the project's “dev” list.

Search for bugs:

This project uses Bugzilla to track ongoing development and issues.

Create a new bug:

Be sure to search for existing bugs before you create another one. Remember that contributions are always welcome!