Fix recently introduced crash in ClippingBoxTestCase
Commit fc7f20c419
did fix a memory leak in
this test case, but at the price of introducing a crash due to deleting
the same pointer twice.
The real fix would be to change the code here to avoid returning a
pointer which sometimes needs to be deleted and sometimes must not, but
for now just add a crude check to avoid crashing.
This commit is contained in:
@@ -1200,14 +1200,15 @@ void ClippingBoxTestCaseDCBase::OneDevRegionNonRect()
|
||||
|
||||
// Draw image with reference triangle.
|
||||
wxBitmap bmpRef(s_dcSize);
|
||||
wxMemoryDC* memDC = new wxMemoryDC(bmpRef);
|
||||
wxDC* dcRef = GetDC(memDC);
|
||||
wxMemoryDC memDC(bmpRef);
|
||||
wxDC* dcRef = GetDC(&memDC);
|
||||
dcRef->SetBackground(wxBrush(s_bgColour, wxBRUSHSTYLE_SOLID));
|
||||
dcRef->Clear();
|
||||
dcRef->SetBrush(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
|
||||
dcRef->SetPen(wxPen(s_fgColour));
|
||||
dcRef->DrawPolygon(WXSIZEOF(poly), poly);
|
||||
delete dcRef;
|
||||
if ( dcRef != &memDC )
|
||||
delete dcRef;
|
||||
|
||||
m_dc->SetDeviceOrigin(10, 15);
|
||||
m_dc->SetUserScale(0.5, 1.5);
|
||||
@@ -1229,7 +1230,6 @@ void ClippingBoxTestCaseDCBase::OneDevRegionNonRect()
|
||||
m_dc->DeviceToLogicalXRel(clipW),
|
||||
m_dc->DeviceToLogicalYRel(clipH), 1);
|
||||
CheckClipShape(bmpRef, 1);
|
||||
delete memDC;
|
||||
}
|
||||
|
||||
void ClippingBoxTestCaseDCBase::OneDevRegionAndReset()
|
||||
|
Reference in New Issue
Block a user