RFR: 8346887: DrawFocusRect() may cause an assertion failure

Sergey Bylokhov serb at openjdk.org
Mon Jan 13 17:03:48 UTC 2025


On Wed, 8 Jan 2025 16:36:07 GMT, Dmitry Markov <dmarkov at openjdk.org> wrote:

> On Windows debug build execution of `DrawFocusRect()` may cause an assertion failure. In particular if a component, which is going to gain a focus, has zero size, the function returns `0` because focus rectangle is empty.
> 
> It is necessary to check that the focus rectangle is not empty before `DrawFocusRect()` call.

src/java.desktop/windows/native/libawt/windows/awt_Button.cpp line 245:

> 243:         VERIFY(::CopyRect(&focusRect, &rect));
> 244:         VERIFY(::InflateRect(&focusRect,-inf,-inf));
> 245:         if (!::IsRectEmpty(&focusRect) && (::DrawFocusRect(hDC, &focusRect) == 0))

If the "focusRect" is empty why we cannot skip most of this method?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22973#discussion_r1913517707


More information about the client-libs-dev mailing list