From: Vadim Zeitlin Date: Thu, 3 Jun 2010 10:35:49 +0000 (+0000) Subject: Test for wxPen validity before testing for its style in wxGTK wxDC. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/1b46c6697fd61c8a00978f7f2e587fd72de505b8 Test for wxPen validity before testing for its style in wxGTK wxDC. Calling wxPen::GetStyle() on an invalid pen resulted in an assert, breaking the grid column drawing while reordering them, for example, because the code in wxGrid uses wxDC::DrawRectangle() after calling SetPen(wxNullPen). Fix this by testing for the pen validity first. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64474 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 0ac7173e3d..f8cd7b6eaa 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -793,9 +793,8 @@ void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoo gdk_gc_set_ts_origin(gc, 0, 0); } - if (m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT) + if ( m_pen.IsOk() && m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT ) { -#if 1 if ((m_pen.GetWidth() == 2) && (m_pen.GetCap() == wxCAP_ROUND) && (m_pen.GetJoin() == wxJOIN_ROUND) && (m_pen.GetStyle() == wxPENSTYLE_SOLID)) { @@ -818,7 +817,6 @@ void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoo gdk_gc_set_line_attributes( m_penGC, 2, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND ); } else -#endif { // Just use X11 for other cases gdk_draw_rectangle( m_gdkwindow, m_penGC, FALSE, xx, yy, ww-1, hh-1 );