浏览代码

oops, need to XFreeColor.

David Rose 16 年之前
父节点
当前提交
b050687720
共有 2 个文件被更改,包括 6 次插入0 次删除
  1. 5 0
      direct/src/plugin/p3dX11SplashWindow.cxx
  2. 1 0
      direct/src/plugin/p3dX11SplashWindow.h

+ 5 - 0
direct/src/plugin/p3dX11SplashWindow.cxx

@@ -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) {

+ 1 - 0
direct/src/plugin/p3dX11SplashWindow.h

@@ -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;