diff --git a/docs/changes.txt b/docs/changes.txt index 0658895d6c..fb0b4773d3 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -189,6 +189,7 @@ wxMSW: - Make wxListCtrl &c appearance more native on modern systems (Tobias Taschner). - Don't send wxActivateEvent for minimized windows (bzcdr). - Return correct OS version under Windows 8.1 and later. +- Fix crash in wxD2DContext when using non-MSVC compiler (iwbnwif). wxOSX/Cocoa: diff --git a/src/msw/graphicsd2d.cpp b/src/msw/graphicsd2d.cpp index b78a573b74..f61e540b93 100644 --- a/src/msw/graphicsd2d.cpp +++ b/src/msw/graphicsd2d.cpp @@ -3349,9 +3349,16 @@ void wxD2DContext::SetPen(const wxGraphicsPen& pen) void wxD2DContext::AdjustRenderTargetSize() { m_renderTargetHolder->Resize(); + + // Currently GetSize() can only be called when using MSVC because gcc + // doesn't handle returning aggregates by value as done by D2D libraries, + // see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64384. Not updating the + // size is not great, but it's better than crashing. +#ifdef __VISUALC__ D2D1_SIZE_F renderTargetSize = m_renderTargetHolder->GetD2DResource()->GetSize(); m_width = renderTargetSize.width; m_height = renderTargetSize.height; +#endif // __VISUALC__ } void wxD2DContext::ReleaseDeviceDependentResources()