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

Alexey Ivanov aivanov at openjdk.org
Wed Jan 8 18:54:44 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.

Looks good.

src/java.desktop/windows/native/libawt/windows/awt_Checkbox.cpp line 292:

> 290:     if ((drawInfo.itemState & ODS_FOCUS) &&
> 291:         ((drawInfo.itemAction & ODA_FOCUS)||
> 292:          (drawInfo.itemAction &ODA_DRAWENTIRE))) {

These two lines ask for spacing adjustment, but it would hide the real fix.

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

Marked as reviewed by aivanov (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/22973#pullrequestreview-2537941602
PR Review Comment: https://git.openjdk.org/jdk/pull/22973#discussion_r1907650682


More information about the client-libs-dev mailing list