RFR: 8185862: AWT Assertion Failure in ::GetDIBits(hBMDC, hBM, 0, 1, 0, gpBitmapInfo, 0) 'awt_Win32GraphicsDevice.cpp', at line 185 [v2]

Christoph Langer clanger at openjdk.org
Thu Feb 15 22:49:54 UTC 2024


On Thu, 15 Feb 2024 09:25:26 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Christoph Langer has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add comments
>
> src/java.desktop/windows/native/libawt/windows/Devices.cpp line 102:
> 
>> 100:     memset((void*)(&mieInfo), 0, sizeof(MONITORINFOEX));
>> 101:     mieInfo.cbSize = sizeof(MONITORINFOEX);
>> 102:     if (TRUE == ::GetMonitorInfo(hMon, (LPMONITORINFOEX)(&mieInfo))) {
> 
> The documentation for [`GetMonitorInfo`](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getmonitorinfow) says, _<q cite="https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getmonitorinfow#return-value">If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.</q>_
> 
> Whereas `TRUE == 1`; therefore the condition should be != 0 or rather simply `if (::GetMonitorInfo(/*params*/))`.

Right, that's what's written. But (in the documentation,) the function is declared as `BOOL GetMonitorInfoW...`. So I could epxect return values of TRUE/FALSE, no?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17614#discussion_r1491754945


More information about the client-libs-dev mailing list