diff options
author | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2011-10-28 14:49:57 +0200 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2011-10-28 15:18:26 +0200 |
commit | 68c6af8de59a265f695793a5820579a18e4255f7 (patch) | |
tree | 27da4a54c230b74aec5a576bd530c67f1b4fe33d /writerperfect/source | |
parent | 0faf9527701238d5de50b1a373dbc1de4b5808f3 (diff) |
Fix a memory leak with opacity gradients
Diffstat (limited to 'writerperfect/source')
-rw-r--r-- | writerperfect/source/filter/OdgGenerator.cxx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/writerperfect/source/filter/OdgGenerator.cxx b/writerperfect/source/filter/OdgGenerator.cxx index 6b08af872a8c..f4d68dce7913 100644 --- a/writerperfect/source/filter/OdgGenerator.cxx +++ b/writerperfect/source/filter/OdgGenerator.cxx @@ -1033,7 +1033,6 @@ void OdgGeneratorPrivate::_writeGraphicsStyle() if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "gradient") { - bUseOpacityGradient = true; TagOpenElement *pDrawGradientElement = new TagOpenElement("draw:gradient"); TagOpenElement *pDrawOpacityElement = new TagOpenElement("draw:opacity"); if (mxStyle["draw:style"]) @@ -1127,14 +1126,10 @@ void OdgGeneratorPrivate::_writeGraphicsStyle() // Work around a mess in LibreOffice where both opacities of 100% are interpreted as complete transparency // Nevertheless, when one is different, immediately, they are interpreted correctly - if (!(mxStyle["libwpg:start-opacity"] && mxStyle["libwpg:end-opacity"]) - || (mxStyle["libwpg:start-opacity"]->getDouble() == 1.0 && mxStyle["libwpg:end-opacity"]->getDouble() == 1.0)) - { - delete pDrawOpacityElement; - bUseOpacityGradient = false; - } - else + if (mxStyle["libwpg:start-opacity"] && mxStyle["libwpg:end-opacity"] + && (mxStyle["libwpg:start-opacity"]->getDouble() != 1.0 || mxStyle["libwpg:end-opacity"]->getDouble() != 1.0)) { + bUseOpacityGradient = true; mGraphicsGradientStyles.push_back(pDrawOpacityElement); mGraphicsGradientStyles.push_back(new TagCloseElement("draw:opacity")); } @@ -1162,6 +1157,9 @@ void OdgGeneratorPrivate::_writeGraphicsStyle() mGraphicsGradientStyles.push_back(pDrawGradientElement); mGraphicsGradientStyles.push_back(new TagCloseElement("draw:gradient")); } + + if(!bUseOpacityGradient) + delete pDrawOpacityElement; } TagOpenElement *pStyleStyleElement = new TagOpenElement("style:style"); |