From 11161c9397890e533320760ee9cc3d0f4023be44 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Mon, 23 Apr 2012 18:59:19 -0700 Subject: [PATCH] Free cairo surface and context when hiding Fl_Single_Window. --- src/Fl.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Fl.cxx b/src/Fl.cxx index 089a6ca..67de13a 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -48,6 +48,10 @@ # endif #endif +#if FLTK_HAVE_CAIRO +#include +#endif + // recent versions of MinGW warn: "Please include winsock2.h before windows.h", // hence we must include winsock2.h before FL/Fl.H (A.S. Dec. 2010, IMM May 2011) #if defined(WIN32) && !defined(__CYGWIN__) @@ -1440,6 +1444,10 @@ void Fl_Window::hide() { # endif // this test makes sure ip->xid has not been destroyed already if (ip->xid) XDestroyWindow(fl_display, ip->xid); +#if FLTK_HAVE_CAIRO + cairo_destroy( ip->cc ); ip->cc = NULL; + cairo_surface_destroy( ip->cs ); ip->cs = NULL; +#endif #elif defined(WIN32) // this little trickery seems to avoid the popup window stacking problem HWND p = GetForegroundWindow();