Fix SetPen() with a re-used user dash array
wxPen::SetDashes() is poorly designed, making it possible for different wxPenRefData objects to point to the same dash array. This allows two wxPen objects to appear to be equal after modifying the array and setting it on the second pen (the drawing sample does this). So testing for equality is not enough to determine that SetPen() can return early.
This commit is contained in:
@@ -1551,7 +1551,8 @@ void wxWindowDCImpl::SetPen( const wxPen &pen )
|
||||
{
|
||||
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
|
||||
|
||||
if (m_pen == pen) return;
|
||||
if (m_pen == pen && (!pen.IsOk() || pen.GetStyle() != wxPENSTYLE_USER_DASH))
|
||||
return;
|
||||
|
||||
m_pen = pen;
|
||||
|
||||
|
Reference in New Issue
Block a user