diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-10-17 15:03:34 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-11-23 14:30:27 +0100 |
commit | 3c6dc4e5bd99b5b32d4c2f4509682e8ada991f47 (patch) | |
tree | a416df02912b7cefd70b50e036972e4d65cdd692 /filter | |
parent | f897304f8237f6b9060ffb953d19d0d5857270cd (diff) |
Resolves: fdo#62682 crash on second export of svg
because the first export has left "dangling" CalcFieldValueHdl Links in
Outliners that got created based on the Drawing Outliner while it had a
temporary CalcFieldValueHdl installed, and didn't get the old CalcFieldValueHdl
installed when the old Drawing Outliner one was re-installed.
(cherry picked from commit 5bdfa8c12472eb9ff6ca054c2ada7150b1869fff)
Change-Id: I064a154ece488c9a4c3467b753451df7e73ae883
Reviewed-on: https://gerrit.libreoffice.org/12009
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/svg/svgexport.cxx | 18 | ||||
-rw-r--r-- | filter/source/svg/svgfilter.hxx | 1 |
2 files changed, 17 insertions, 2 deletions
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 07cf0a40da10..7dc2419226ca 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -602,7 +602,8 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) SdrOutliner& rOutl = mpSdrModel->GetDrawOutliner(NULL); maOldFieldHdl = rOutl.GetCalcFieldValueHdl(); - rOutl.SetCalcFieldValueHdl( LINK( this, SVGFilter, CalcFieldHdl) ); + maNewFieldHdl = LINK(this, SVGFilter, CalcFieldHdl); + rOutl.SetCalcFieldValueHdl(maNewFieldHdl); } } bRet = implExportDocument(); @@ -615,7 +616,20 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) } if( mpSdrModel ) - mpSdrModel->GetDrawOutliner( NULL ).SetCalcFieldValueHdl( maOldFieldHdl ); + { + //fdo#62682 The maNewFieldHdl can end up getting copied + //into various other outliners which live past this + //method, so get the full list of outliners and restore + //the maOldFieldHdl for all that have ended up using + //maNewFieldHdl + std::vector<SdrOutliner*> aOutliners(mpSdrModel->GetActiveOutliners()); + for (std::vector<SdrOutliner*>::iterator aIter = aOutliners.begin(); aIter != aOutliners.end(); ++aIter) + { + SdrOutliner* pOutliner = *aIter; + if (maNewFieldHdl == pOutliner->GetCalcFieldValueHdl()) + pOutliner->SetCalcFieldValueHdl(maOldFieldHdl); + } + } delete mpSVGWriter, mpSVGWriter = NULL; mpSVGExport = NULL; // pointed object is released by xSVGExport dtor at the end of this scope diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx index 7b68c2b640ed..0c6371f3902b 100644 --- a/filter/source/svg/svgfilter.hxx +++ b/filter/source/svg/svgfilter.hxx @@ -265,6 +265,7 @@ private: XDrawPageSequence mMasterPageTargets; Link maOldFieldHdl; + Link maNewFieldHdl; bool implImport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException); |