RFR: 8378153: Robot.getPixelColor() may return stale pixels due to missing Toolkit.sync()
Sergey Bylokhov
serb at openjdk.org
Thu Feb 19 02:09:50 UTC 2026
Robot.getPixelColor() does not call Toolkit.getDefaultToolkit().sync() before reading the pixel, unlike Robot.createScreenCapture() which has had this call since [JDK-6725214](https://bugs.openjdk.org/browse/JDK-6725214).
When a hardware-accelerated pipeline (OGL, D3D, Metal) is active, rendering may be buffered and not yet flushed to the screen when getPixelColor() reads the pixel. This causes it to return stale values typically the window background color instead of the rendered content.
-------------
Commit messages:
- 8378153: Robot.getPixelColor() may return stale pixels due to missing Toolkit.sync()
Changes: https://git.openjdk.org/jdk/pull/29780/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29780&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8378153
Stats: 4 lines in 1 file changed: 3 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/29780.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29780/head:pull/29780
PR: https://git.openjdk.org/jdk/pull/29780
More information about the client-libs-dev
mailing list