From be9c92f6f20c89099255bf4c30967d03a27cfcf3 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Mon, 12 Jan 2015 20:29:02 +0000 Subject: [PATCH] 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 --- src/propgrid/editors.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index 29459269ec..757dc20e19 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -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;