From 375fc5a970eca2b3d0f2eec47c8e8cdaf5a1761c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 22 Sep 2003 12:20:39 +0000 Subject: [PATCH] fix for crash when using user-dashed lines (patch 801663) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23810 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/gtk/dcclient.cpp | 6 ++++++ src/gtk1/dcclient.cpp | 6 ++++++ 3 files changed, 13 insertions(+) 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}; -- 2.45.2