[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: RFR: JDK-8294427 - Check boxes and radio buttons have rendering issues on Windows in High DPI en
From:       Alexey Ivanov <aivanov () openjdk ! org>
Date:       2023-05-31 21:44:10
Message-ID: VYLtZMhioS1-r54XNrQZtYNdw9bpW1G2zys7Xupjo_4=.994080a7-bf93-4de5-9d17-a5ab9b17ce66 () github ! com
[Download RAW message or body]

On Tue, 30 May 2023 16:04:55 GMT, Alexey Ivanov <aivanov@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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic