oops, need to XFreeColor.

This commit is contained in:
David Rose 2009-08-17 19:30:41 +00:00
parent de2788c4cc
commit b050687720
2 changed files with 6 additions and 0 deletions

View File

@ -638,6 +638,7 @@ setup_gc() {
Colormap colormap = DefaultColormap(_display, _screen); Colormap colormap = DefaultColormap(_display, _screen);
if (XAllocColor(_display, colormap, &blue)) { if (XAllocColor(_display, colormap, &blue)) {
_blue_pixel = blue.pixel;
gcval.foreground = blue.pixel; gcval.foreground = blue.pixel;
} }
@ -667,6 +668,10 @@ close_window() {
XFreeGC(_display, _bar_context); XFreeGC(_display, _bar_context);
} }
_bar_context = None; _bar_context = None;
// Also free the color we allocated.
Colormap colormap = DefaultColormap(_display, _screen);
XFreeColors(_display, colormap, &_blue_pixel, 1, 0);
} }
if (_graphics_context != None) { if (_graphics_context != None) {

View File

@ -81,6 +81,7 @@ private:
int _screen; int _screen;
GC _graphics_context; GC _graphics_context;
GC _bar_context; GC _bar_context;
unsigned long _blue_pixel;
XImage* _image; XImage* _image;
XImage* _resized_image; XImage* _resized_image;
int _image_width, _image_height; int _image_width, _image_height;