From 2fdc6ab808d3828cba1bacaff536d607dfa60c58 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sat, 10 Jun 2006 20:23:00 +0000 Subject: dont free old color until we have a valid new color --- src/FbTk/Color.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/FbTk/Color.cc b/src/FbTk/Color.cc index f8dfe3a..9e3868e 100644 --- a/src/FbTk/Color.cc +++ b/src/FbTk/Color.cc @@ -116,7 +116,7 @@ bool Color::validColorString(const char *color_string, int screen) { return XParseColor(disp, colm, color_string_tmp.c_str(), &color) != 0; } -Color &Color::operator = (const Color &col_copy) { +Color &Color::operator = (const Color &col_copy) { // check for aliasing if (this == &col_copy) return *this; @@ -144,8 +144,6 @@ void Color::copy(const Color &col_copy) { setPixel(col_copy.pixel()); return; } - - free(); allocate(col_copy.red()*0xFF, col_copy.green()*0xFF, @@ -168,6 +166,7 @@ void Color::allocate(unsigned short red, unsigned short green, unsigned short bl _FB_USES_NLS; cerr<<"FbTk::Color: "<<_FBTKTEXT(Error, ColorAllocation, "Allocation error.", "XAllocColor failed...")<