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). ------------- Commit messages: - JDK-8283401: ArrayIndexOutOfBoundsException when disconnecting screen(s) Changes: https://git.openjdk.org/jfx/pull/1200/files Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1200&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8283401 Stats: 6 lines in 1 file changed: 6 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jfx/pull/1200.diff Fetch: git fetch https://git.openjdk.org/jfx.git pull/1200/head:pull/1200 PR: https://git.openjdk.org/jfx/pull/1200