From f60e7fdddbc67eb34b376b54d4b844595f82ab00 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 2 May 2002 13:52:43 +0000 Subject: [PATCH] dumb fix for wxDC::Clear() crash git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15334 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/dcclient.cpp | 10 ++++++++++ src/gtk1/dcclient.cpp | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 92566a3da0..736b8a1332 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -1560,6 +1560,11 @@ void wxWindowDC::Clear() if (!m_window) return; + // VZ: the code below results in infinite recursion and crashes when + // dc.Clear() is done from OnPaint() so I disable it for now. + // I don't know what the correct fix is but Clear() surely should not + // reenter OnPaint()! +#if 0 /* - we either are a memory dc or have a window as the owner. anything else shouldn't happen. - we don't use gdk_window_clear() as we don't set @@ -1580,6 +1585,11 @@ void wxWindowDC::Clear() gdk_draw_rectangle( m_window, m_bgGC, TRUE, 0, 0, width, height ); return; } +#else // 1 + int width,height; + GetSize( &width, &height ); + gdk_draw_rectangle( m_window, m_bgGC, TRUE, 0, 0, width, height ); +#endif // 0/1 } void wxWindowDC::SetFont( const wxFont &font ) diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index 92566a3da0..736b8a1332 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -1560,6 +1560,11 @@ void wxWindowDC::Clear() if (!m_window) return; + // VZ: the code below results in infinite recursion and crashes when + // dc.Clear() is done from OnPaint() so I disable it for now. + // I don't know what the correct fix is but Clear() surely should not + // reenter OnPaint()! +#if 0 /* - we either are a memory dc or have a window as the owner. anything else shouldn't happen. - we don't use gdk_window_clear() as we don't set @@ -1580,6 +1585,11 @@ void wxWindowDC::Clear() gdk_draw_rectangle( m_window, m_bgGC, TRUE, 0, 0, width, height ); return; } +#else // 1 + int width,height; + GetSize( &width, &height ); + gdk_draw_rectangle( m_window, m_bgGC, TRUE, 0, 0, width, height ); +#endif // 0/1 } void wxWindowDC::SetFont( const wxFont &font ) -- 2.50.0