From dca8c61a91cab29128a72f252b70f4bd9f7786ff Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 13 Feb 2003 05:07:25 +0000 Subject: [PATCH] free the colors on shutdown --- otk/pseudorendercontrol.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/otk/pseudorendercontrol.cc b/otk/pseudorendercontrol.cc index 4e2691a2..2b878200 100644 --- a/otk/pseudorendercontrol.cc +++ b/otk/pseudorendercontrol.cc @@ -101,7 +101,12 @@ PseudoRenderControl::~PseudoRenderControl() { printf("Destroying PseudoColor RenderControl\n"); - delete _colors; + unsigned long *pixels = new unsigned long [ncolors], *p = pixels; + for (int i = 0; i < _ncolors; ++i, ++p) + *p = _colors[i].pixel; + XFreeColors(**display, display->screenInfo(_screen)->colormap(), pixels, + _ncolors, 0); + delete [] colors; } void PseudoRenderControl::reduceDepth(Surface &sf, XImage *im) const -- 2.45.2