> Java2D's `Disposer` maintains a record of objects to dispose of with the help > of a collection that isn't thread safe. When `DisposerRecords` objects are > being added to it at the same time as others are being disposed on the > Toolkit thread, chaos ensues. > > This commit replaces the collection with a thread-safe one, more > consistently guards against exceptions in individual disposers, and adds > exception's stacktraces printing in order to facilitate said exceptions' > debugging, which are otherwise hard to pinpoint without code modification. > > Originally, the bug was caught on MacOS running an existing test > (`DrawRotatedStringUsingRotatedFont`) that would occasionally crash the VM > (probably due to double-free detected by libc that abort()'s in this case). > It may take many re-tries to reproduce and this wasn't observed on Linux. > The new test (`test/jdk/sun/java2d/Disposer/TestDisposerRace.java`) displays > the problem in a more reliable fashion and fails both on MacOS and Linux > without this fix.
Maxim Kartashev has updated the pull request incrementally with one additional commit since the last revision: Made DrawRotatedStringUsingRotatedFont.java headful and dropped extra test ------------- Changes: - all: https://git.openjdk.org/jdk/pull/9362/files - new: https://git.openjdk.org/jdk/pull/9362/files/a1c76241..eb393c6b Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=9362&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=9362&range=00-01 Stats: 48 lines in 2 files changed: 1 ins; 46 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/9362.diff Fetch: git fetch https://git.openjdk.org/jdk pull/9362/head:pull/9362 PR: https://git.openjdk.org/jdk/pull/9362
