Sanity check regarding DC in wxPropertyGrid::OnComboItemPaint

Ensure that wxDC used by drawing functions in wxPropertyGrid::OnComboItemPaint is valid.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78366 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Artur Wieczorek
2015-01-12 20:29:02 +00:00
parent a90597a355
commit be9c92f6f2

View File

@@ -796,17 +796,17 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb,
if ( (flags & wxODCB_PAINTING_CONTROL) ) if ( (flags & wxODCB_PAINTING_CONTROL) )
paintdata.m_choiceItem = -1; paintdata.m_choiceItem = -1;
if ( pDc ) wxCHECK_RET( pDc, wxT("Invalid DC") );
pDc->SetBrush(*wxWHITE_BRUSH);
wxPGCellRenderer* renderer = NULL; wxDC& dc = *pDc;
const wxPGChoiceEntry* cell = NULL; dc.SetBrush(*wxWHITE_BRUSH);
if ( rect.x >= 0 ) if ( rect.x >= 0 )
{ {
// //
// DrawItem call // DrawItem call
wxDC& dc = *pDc; wxPGCellRenderer* renderer = NULL;
const wxPGChoiceEntry* cell = NULL;
wxPoint pt(rect.x + wxPG_CONTROL_MARGIN - wxPG_CHOICEXADJUST - 1, wxPoint pt(rect.x + wxPG_CONTROL_MARGIN - wxPG_CHOICEXADJUST - 1,
rect.y + 1); rect.y + 1);
@@ -927,7 +927,6 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb,
{ {
// //
// MeasureItem call // MeasureItem call
wxDC& dc = *pDc;
p->OnCustomPaint( dc, rect, paintdata ); p->OnCustomPaint( dc, rect, paintdata );
rect.height = paintdata.m_drawnHeight + 2; rect.height = paintdata.m_drawnHeight + 2;