Work around a crash in wxD2DContext when using gcc

Don't call GetSize() method as gcc can't handle aggregates returned by value
from D2D libraries currently and the code just crashes if this method is
called.

See #17171.
This commit is contained in:
Vadim Zeitlin
2016-01-30 01:55:15 +01:00
parent 0220d86ef4
commit a7d31701ab
2 changed files with 8 additions and 0 deletions

View File

@@ -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:

View File

@@ -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()