Add more error checks to Direct2D wxGraphics code
Check the result of the operations instead of just assigning them to "hr" variable which is then never used.
This commit is contained in:
committed by
Vadim Zeitlin
parent
c932c8054b
commit
99573ecddd
@@ -2078,6 +2078,7 @@ wxD2DFontData::wxD2DFontData(wxGraphicsRenderer* renderer, ID2D1Factory* d2dFact
|
||||
|
||||
wxCOMPtr<IDWriteGdiInterop> gdiInterop;
|
||||
hr = wxDWriteFactory()->GetGdiInterop(&gdiInterop);
|
||||
wxCHECK_HRESULT_RET(hr);
|
||||
|
||||
LOGFONTW logfont;
|
||||
GetObjectW(font.GetHFONT(), sizeof(logfont), &logfont);
|
||||
@@ -2092,6 +2093,7 @@ wxD2DFontData::wxD2DFontData(wxGraphicsRenderer* renderer, ID2D1Factory* d2dFact
|
||||
}
|
||||
|
||||
hr = gdiInterop->CreateFontFromLOGFONT(&logfont, &m_font);
|
||||
wxCHECK_HRESULT_RET(hr);
|
||||
|
||||
wxCOMPtr<IDWriteFontFamily> fontFamily;
|
||||
m_font->GetFontFamily(&fontFamily);
|
||||
@@ -2119,6 +2121,8 @@ wxD2DFontData::wxD2DFontData(wxGraphicsRenderer* renderer, ID2D1Factory* d2dFact
|
||||
&m_textFormat);
|
||||
|
||||
delete[] name;
|
||||
|
||||
wxCHECK_HRESULT_RET(hr);
|
||||
}
|
||||
|
||||
wxCOMPtr<IDWriteTextLayout> wxD2DFontData::CreateTextLayout(const wxString& text) const
|
||||
@@ -2137,6 +2141,7 @@ wxCOMPtr<IDWriteTextLayout> wxD2DFontData::CreateTextLayout(const wxString& text
|
||||
MAX_WIDTH,
|
||||
MAX_HEIGHT,
|
||||
&textLayout);
|
||||
wxCHECK2_HRESULT_RET(hr, wxCOMPtr<IDWriteTextLayout>(NULL));
|
||||
|
||||
DWRITE_TEXT_RANGE textRange = { 0, (UINT32) text.length() };
|
||||
|
||||
|
Reference in New Issue
Block a user