Fix crash when closing a wxColourDialog under MSW

Check that ms_pfnSetThreadDpiAwarenessContext function pointer was
initialized before using it.

This fixes a regression introduced in 9befda5c26 (Only use
AutoSystemDpiAware when displays have different DPI, 2023-12-10).

See #24121, #24196.

Closes #24288.
This commit is contained in:
Maarten Bent 2024-02-06 19:07:46 +01:00 committed by Vadim Zeitlin
parent 36583f13e1
commit c72f4efc9c

View file

@ -61,7 +61,8 @@ public:
~AutoSystemDpiAware()
{
if ( ms_pfnSetThreadDpiAwarenessContext )
if ( ms_pfnSetThreadDpiAwarenessContext &&
ms_pfnSetThreadDpiAwarenessContext != (SetThreadDpiAwarenessContext_t)-1 )
{
ms_pfnSetThreadDpiAwarenessContext(m_prevContext);
}