diff --git a/docs/changes.txt b/docs/changes.txt index af3b8bbe6f..2e22f46982 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -66,6 +66,7 @@ wxMSW: wxGTK: - fixes to wxTextCtrl scrolling under GTK2 (Nerijus Baliunas) +- fix for crash when using user-dashed lines (Chris Borgolte) 2.5.0 diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 47c3ec2174..92ae53ff9d 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -1838,6 +1838,12 @@ void wxWindowDC::SetPen( const wxPen &pen ) ( fabs((double) XLOG2DEVREL(width)) + fabs((double) YLOG2DEVREL(width)) ) / 2.0; width = (int)w; + if ( !width ) + { + // width can't be 0 or an internal GTK error occurs inside + // gdk_gc_set_dashes() below + width = 1; + } } static const wxGTKDash dotted[] = {1, 1}; diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index 47c3ec2174..92ae53ff9d 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -1838,6 +1838,12 @@ void wxWindowDC::SetPen( const wxPen &pen ) ( fabs((double) XLOG2DEVREL(width)) + fabs((double) YLOG2DEVREL(width)) ) / 2.0; width = (int)w; + if ( !width ) + { + // width can't be 0 or an internal GTK error occurs inside + // gdk_gc_set_dashes() below + width = 1; + } } static const wxGTKDash dotted[] = {1, 1};