RFR: 8378153: Robot.getPixelColor() may return stale pixels due to missing Toolkit.sync()
Alexander Zvegintsev
azvegint at openjdk.org
Fri Feb 20 01:26:56 UTC 2026
On Wed, 18 Feb 2026 08:24:22 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
> 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.
Marked as reviewed by azvegint (Reviewer).
-------------
PR Review: https://git.openjdk.org/jdk/pull/29780#pullrequestreview-3829366575
More information about the client-libs-dev
mailing list