diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 93bb8f27c8..345427d25a 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1671,7 +1671,11 @@ void wxWindowMSW::GetTextExtent(const wxString& string, wxASSERT_MSG( !theFont || theFont->Ok(), _T("invalid font in GetTextExtent()") ); - const wxFont fontToUse(theFont ? *theFont : GetFont()); + wxFont fontToUse; + if (theFont) + fontToUse = *theFont; + else + fontToUse = GetFont(); WindowHDC hdc(GetHwnd()); SelectInHDC selectFont(hdc, GetHfontOf(fontToUse));