From 41311298eb1ca101907b9f49dfb095a0cca00518 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Mon, 31 Jul 2017 10:14:26 -0700 Subject: [PATCH] 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. --- src/gtk/dcclient.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index d8bd83a7bd..53968f6631 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -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;