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