RFR: JDK-8294427 - Check boxes and radio buttons have rendering issues on Windows in High DPI env [v6]

Alexey Ivanov aivanov at openjdk.org
Wed May 31 21:44:10 UTC 2023


On Tue, 30 May 2023 16:04:55 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> src/java.desktop/windows/classes/sun/awt/windows/ThemeReader.java line 131:
>> 
>>> 129:                         }
>>> 130:                         dpiAwareWidgetToTheme.get(dpi).clear();
>>> 131:                         dpiAwareWidgetToTheme.clear();
>> 
>> Suggestion:
>> 
>>                         for (Map<String, Long> dpiVal : dpiAwareWidgetToTheme.values()) {
>>                             for (Long value : dpiVal.values()) {
>>                                 closeTheme(value);
>>                             }
>>                             dpiVal.clear();
>>                         }
>>                         dpiAwareWidgetToTheme.clear();
>> 
>> Avoid additional call to `get`.
>
> This is even more serious: all the theme handles are closed but the maps for DPIs other than the passed `dpi` aren't cleared. With `clear` inside the loop, maps for all DPIs are cleared.

I've thought about it more, and I was **wrong**.

Clearing the `dpiVal` map isn't needed at all because as the next step the outer map gets cleared, meaning that maps with theme handles are thrown away. Thus, no need to waste time to run `dpiVal.clear()` — `dpiAwareWidgetToTheme.clear()` takes care of those too.

That is remove the line `dpiVal.clear()`, please.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13701#discussion_r1212347708



More information about the client-libs-dev mailing list