X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f96aa4d9eb296b3dfc468a351ce013bf92fab983..5db1a502b4bf38f36a14c1377618d9eaae4c8e79:/src/gtk1/dcclient.cpp?ds=inline diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index 1d46f8b455..3e8025961b 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -119,6 +119,7 @@ wxPaintDC::wxPaintDC( wxWindow *window ) wxPaintDC::~wxPaintDC(void) { + Destroy(); } void wxPaintDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1), @@ -827,15 +828,12 @@ void wxPaintDC::DestroyClippingRegion(void) void wxPaintDC::SetUpDC(void) { + Destroy(); m_ok = TRUE; m_logicalFunction = wxCOPY; - if (m_penGC) gdk_gc_unref( m_penGC ); m_penGC = gdk_gc_new( m_window ); - if (m_brushGC) gdk_gc_unref( m_brushGC ); m_brushGC = gdk_gc_new( m_window ); - if (m_textGC) gdk_gc_unref( m_textGC ); m_textGC = gdk_gc_new( m_window ); - if (m_bgGC) gdk_gc_unref( m_bgGC ); m_bgGC = gdk_gc_new( m_window ); SetTextForeground( m_textForegroundColour ); SetTextBackground( m_textBackgroundColour ); @@ -857,6 +855,18 @@ void wxPaintDC::SetUpDC(void) } } +void wxPaintDC::Destroy(void) +{ + if (m_penGC) gdk_gc_unref( m_penGC ); + m_penGC = (GdkGC*) NULL; + if (m_brushGC) gdk_gc_unref( m_brushGC ); + m_brushGC = (GdkGC*) NULL; + if (m_textGC) gdk_gc_unref( m_textGC ); + m_textGC = (GdkGC*) NULL; + if (m_bgGC) gdk_gc_unref( m_bgGC ); + m_bgGC = (GdkGC*) NULL; +} + GdkWindow *wxPaintDC::GetWindow(void) { return m_window;