From: sasha Date: Wed, 14 Nov 2007 22:25:41 +0000 (+0000) Subject: added destructor to bgPixmap, to cleanup after itself. That was probably the cause... X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=c8357a758e46a636f92297fb8e5831de25d93a18;p=dana%2Furxvt.git added destructor to bgPixmap, to cleanup after itself. That was probably the cause of the huge pixmap leak in rxvtd --- diff --git a/src/background.C b/src/background.C index fb800a8f..ac7ffee4 100644 --- a/src/background.C +++ b/src/background.C @@ -102,6 +102,15 @@ bgPixmap_t::bgPixmap_t() pixmap = None; } +bgPixmap_t::~bgPixmap_t() +{ +#ifdef HAVE_AFTERIMAGE + if (original_asim) + safe_asimage_destroy (original_asim); +#endif + if (pixmap && target) + XFreePixmap (target->dpy, pixmap); +} bool bgPixmap_t::window_size_sensitive () diff --git a/src/background.h b/src/background.h index ede6ab85..59a3913a 100644 --- a/src/background.h +++ b/src/background.h @@ -16,6 +16,7 @@ struct bgPixmap_t { bgPixmap_t(); + ~bgPixmap_t(); enum { geometrySet = (1UL<<0), diff --git a/src/rxvttoolkit.C b/src/rxvttoolkit.C index a7e42a06..626c7104 100644 --- a/src/rxvttoolkit.C +++ b/src/rxvttoolkit.C @@ -888,3 +888,19 @@ rxvt_color::fade (rxvt_screen *screen, int percent, rxvt_color &result, const rg ); } +#if TRACE_PIXMAPS +# undef XCreatePixmap +# undef XFreePixmap +Pixmap trace_XCreatePixmap (const char *file, int line, Display *dpy, Window r, unsigned int w, unsigned int h, unsigned int d) +{ + Pixmap res = XCreatePixmap (dpy, r, w, h, d); + fprintf (stderr, "%s:%d: XCreatePixmap (%p,%lX,%u,%u,%u) returned %lX\n", file, line, dpy, r, w, h, d, res); + return res; +} + +void trace_XFreePixmap (const char *file, int line, Display *dpy, Pixmap p) +{ + fprintf (stderr, "%s:%d: XFreePixmap (%p,%lX)\n", file, line, dpy, p); + XFreePixmap (dpy,p); +} +#endif diff --git a/src/rxvttoolkit.h b/src/rxvttoolkit.h index 536eb484..cec0d379 100644 --- a/src/rxvttoolkit.h +++ b/src/rxvttoolkit.h @@ -338,5 +338,13 @@ struct rxvt_color { void fade (rxvt_screen *screen, int percent, rxvt_color &result, const rgba &to = rgba (0, 0, 0)); }; +#if TRACE_PIXMAPS +Pixmap trace_XCreatePixmap (const char *file, int line, Display *dpy, Window r, unsigned int w, unsigned int h, unsigned int d); +void trace_XFreePixmap (const char *file, int line, Display *dpy, Pixmap p); + +# define XCreatePixmap(dpy,r,w,h,d) trace_XCreatePixmap (__FILE__,__LINE__,dpy,r,w,h,d) +# define XFreePixmap(dpy,p) trace_XFreePixmap (__FILE__,__LINE__,dpy,p) +#endif + #endif