--- rxvt-unicode/src/main.C 2014/12/13 10:07:30 1.394 +++ rxvt-unicode/src/main.C 2015/09/08 07:54:58 1.398 @@ -256,7 +256,8 @@ { pix_colors_focused [i].free (this); #if OFF_FOCUS_FADING - pix_colors_unfocused [i].free (this); + if (rs[Rs_fade]) + pix_colors_unfocused [i].free (this); #endif } @@ -282,7 +283,7 @@ if (env && memcmp (env, envv->begin (), envv->size () * sizeof (char *))) rxvt_warn ("env has been modified, probably as a result of a lib calling setenv.\n"); - delete env; + delete [] env; delete envv; delete argv; @@ -943,8 +944,6 @@ rxvt_term::set_window_color (int idx, const char *color) { #ifdef XTERM_COLOR_CHANGE - rxvt_color xcol; - if (color == NULL || *color == '\0') return; @@ -960,38 +959,32 @@ if (i >= 8 && i <= 15) { /* bright colors */ - pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i - 8]; + alias_color (idx, minBrightCOLOR + i - 8); goto done; } if (i >= 0 && i <= 7) { /* normal colors */ - pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i]; + alias_color (idx, minCOLOR + i); goto done; } } - set_color (xcol, color); - - /* - * FIXME: should free colors here, but no idea how to do it so instead, - * so just keep gobbling up the colormap - */ - - pix_colors_focused[idx] = xcol; + pix_colors_focused[idx].free (this); + set_color (pix_colors_focused[idx], color); done: /*TODO: handle Color_BD, scrollbar background, etc. */ update_fade_color (idx); - recolour_cursor (); - scr_recolour (); + recolor_cursor (); + scr_recolor (); #endif /* XTERM_COLOR_CHANGE */ } void -rxvt_term::recolour_cursor () +rxvt_term::recolor_cursor () { XColor fg, bg; @@ -1056,6 +1049,7 @@ void rxvt_term::alias_color (int dst, int src) { + pix_colors[dst].free (this); pix_colors[dst].set (this, rs[Rs_color + dst] = rs[Rs_color + src]); }