| commit | 67a97c468e0014f6c8600845c02ae11a246cdda0 | [log] [tgz] |
|---|---|---|
| author | Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com> | Thu Jun 17 00:09:26 2021 +0300 |
| committer | Niraj Modi <niraj.modi@in.ibm.com> | Mon Jun 21 12:02:05 2021 -0400 |
| tree | 7c5962dc198960dc90a3e769cb6eb33230bf3bdf | |
| parent | 6d049870baa1d29060eba373a68d85abd34d40d9 [diff] |
Bug 562408 - Various problems when native->java callback throws RuntimeException The problem occurred with a single native API called multiple Java callbacks, and one of such callbacks thrown a Java exception. In such case, all subsequent callbacks were skipped until the native API returned. Sometimes a caller does not expect that callback will be skipped (or does not expect the default return value from callback) and will do weird things or downright crash JVM. A simple way to understand how a single native API could call multiple callbacks is a Table with multiple items. A single "paint()" native API will invoke Measure/Paint/etc callbacks per every item and will not return until everything is done. This patch fixes the problem: now even if one of the callbacks throws, the others will still execute as normal. One potential side effect is that some unexpected callbacks will now be called. For example, consider a theoretical native API that invokes 3 callbacks: "init", "doWork" and "cleanup". Previously, if "init" thrown, "doWork" and "cleanup" would be skipped, but this is no longer the case. I understand that this side effect is reasonable, because throwing RuntimeException's is not a proper way to cancel something. If something does indeed need to be canceled on exception, this shall be done with an explicit cancel. Alternatively, SWT can be taught to explicitly skip specific subsequent callbacks if the previous one thrown. This patch also removes 'JNI_VERSION' which is not used since 569853. Change-Id: Ic428e081dc19eeb65e40a690388538b87601977e Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com> Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/182120 Tested-by: Platform Bot <platform-bot@eclipse.org> Reviewed-by: Niraj Modi <niraj.modi@in.ibm.com>
Thanks for your interest in this project.
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.
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.
This project uses Bugzilla to track ongoing development and issues.
Be sure to search for existing bugs before you create another one. Remember that contributions are always welcome!