]> git.saurik.com Git - wxWidgets.git/commitdiff
Test for wxPen validity before testing for its style in wxGTK wxDC.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 3 Jun 2010 10:35:49 +0000 (10:35 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 3 Jun 2010 10:35:49 +0000 (10:35 +0000)
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

src/gtk/dcclient.cpp

index 0ac7173e3df2163732fb25595e0815f5d9390ea5..f8cd7b6eaae7f4a122069813797b6c0e1f95e793 100644 (file)
@@ -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 );