- printf("DESTROY COLOR: %lx %d\n", color, item->count);
-
- if (--item->count <= 0) {
- // remove from the cache
- XFreeGC(**display, _gc);
- _cache[_screen][color] = 0;
- delete item;
+ if (--item->count <= 0) {
+ // remove from the cache
+ XFreeGC(**display, _gc);
+ _cache[_screen][color] = 0;
+ delete item;
+
+ if (_allocated) {
+ const ScreenInfo *info = display->screenInfo(_screen);
+ XFreeColors(**display, info->colormap(), &_pixel, 1, 0);
+ }
+ }