diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-01-29 16:25:30 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-01-29 16:25:30 +0100 |
commit | 43ffe310792e3bd73be73631c8619b4e3cf5db22 (patch) | |
tree | 29ca90bf2300420b5c63315397a8312e854c3142 /src | |
parent | cf67233a08169d16537640b43009122b788c1cf8 (diff) |
free font names when replacing them
Diffstat (limited to 'src')
-rw-r--r-- | src/css.cc | 19 | ||||
-rw-r--r-- | src/css.hh | 10 |
2 files changed, 15 insertions, 14 deletions
@@ -25,25 +25,16 @@ void CssProperty::print () { } CssPropertyList::~CssPropertyList () { - if (ownerOfStrings) { - for (int i = 0; i < size (); i++) { - CssProperty *p = getRef (i); - - switch (p->name) { - case CssProperty::CSS_PROPERTY_CONTENT: - case CssProperty::CSS_PROPERTY_FONT_FAMILY: - dFree (p->value.strVal); - break; - default: - break; - } - } - } + if (ownerOfStrings) + for (int i = 0; i < size (); i++) + getRef (i)->free (); } void CssPropertyList::set (CssProperty::Name name, CssProperty::Value value) { for (int i = 0; i < size (); i++) if (getRef (i)->name == name) { + if (ownerOfStrings) + getRef (i)->free (); getRef (i)->value = value; return; } @@ -160,6 +160,16 @@ class CssProperty { Name name; Value value; + void free () { + switch (name) { + case CssProperty::CSS_PROPERTY_CONTENT: + case CssProperty::CSS_PROPERTY_FONT_FAMILY: + dFree (value.strVal); + break; + default: + break; + } + } void print (); }; |