RFR: JDK-8283401: ArrayIndexOutOfBoundsException when disconnecting screen(s)

Michael Strauß mstrauss at openjdk.org
Fri Aug 11 21:38:01 UTC 2023


On Sat, 5 Aug 2023 13:00:36 GMT, Marius Hanl <mhanl at openjdk.org> wrote:

> When the `D3DPipeline` is reinitialized, the adapter ordinal of all the `Screen`s are outdated.
> As a consequence, when a `D3DResourceFactory` is created for a `Screen` (adapter ordinal), the code may fail with an `ArrayIndexOutOfBoundsException` as the ordinal is higher than what we would expect it to be.
> 
> Example:
> We have 3 screens. Adapter ordinal 0, 1, 2.
> If we now disconnect 2 screens, we only have one screen left. 
> The `D3DPipeline` is reinitialized as a [D3DERR_DEVICEREMOVED](https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3derr) is reported from Direct3d9.
> Now the remaining screen may have the adapter ordinal 1 (from before). But since we only have 1 screen left, it should have the adapter ordinal 0. 
> 
> Direct3d9 will also return 0 as adapter ordinal if you call it. And that is what we do to update the `Screen` and fix this problem.
> 
> See also the ticket for information how to reproduce this problem (Windows only).

Marked as reviewed by mstrauss (Committer).

-------------

PR Review: https://git.openjdk.org/jfx/pull/1200#pullrequestreview-1574385377


More information about the openjfx-dev mailing list