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:
Paul Cornett
2017-07-31 10:14:26 -07:00
parent d57672ee42
commit 41311298eb

View File

@@ -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;