diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-08-22 10:08:42 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-08-22 17:38:28 +0200 |
commit | 27fb6f228271637070e0e0a69d7df503250d8bde (patch) | |
tree | d0dae88d4da34af3d9658b24f726efac450dc40f /sd/inc | |
parent | 6073627ddc50de5d1222c89712c350ef34eaa0e1 (diff) |
Resolves: tdf#119259 reused in-use SdStyleSheet removed by undo
since...
commit a4cd841541a729d7b8126d27d91fa28e30b01403
Date: Thu Feb 13 16:10:47 2014 +0530
n#757432: Styles (rename &) copy to different decks.
While copying slides to different slide decks,
styles were not being copied if there is already one
with the same name. This patch renames and copies those
to keep the formatting intact.
if a SdStyleSheet is not freshly created, but reused, it ends up in
the rCreatedSheets list, and so when the copy is undone
(via SdMoveStyleSheetsUndoAction), the SdStyleSheet is unconditionally
remove from the StylePool and so its ref count hits 0 and is removed,
even though there are still objects depending on it.
the problem becames more common since...
bash-4.4$ git show 57db6e24b5ad43d447c30e44a112c74c7e75b46b
commit 57db6e24b5ad43d447c30e44a112c74c7e75b46b
Date: Tue Aug 15 02:51:07 2017 +0530
Removing old SfxItemSet::getHash usage
improves the SfxItemSet comparison.
Assuming that its correct to leave SdStyleSheetPool::CopySheets
with those reused SdStyleSheets in the list, change things so
that a flag is passed around to indicate if the SdStyleSheet
should be removed or not by undo
Change-Id: I82b5bd93183fd1ff9e67957ccfb5babef81fd36d
Reviewed-on: https://gerrit.libreoffice.org/59432
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd/inc')
-rw-r--r-- | sd/inc/stlpool.hxx | 10 | ||||
-rw-r--r-- | sd/inc/stlsheet.hxx | 13 |
2 files changed, 18 insertions, 5 deletions
diff --git a/sd/inc/stlpool.hxx b/sd/inc/stlpool.hxx index cfe639038f9a..f4cf930d26e3 100644 --- a/sd/inc/stlpool.hxx +++ b/sd/inc/stlpool.hxx @@ -70,12 +70,12 @@ public: SD_DLLPUBLIC void CreateLayoutStyleSheets(const OUString& rLayoutName, bool bCheck = false ); static void CreateLayoutSheetNames(const OUString& rLayoutName, std::vector<OUString> &aNameList); void CreateLayoutSheetList(const OUString& rLayoutName, SdStyleSheetVector& rLayoutSheets); - void CopyLayoutSheets(const OUString& rLayoutName, SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets ); + void CopyLayoutSheets(const OUString& rLayoutName, SdStyleSheetPool& rSourcePool, StyleSheetCopyResultVector& rCreatedSheets); void CopyGraphicSheets(SdStyleSheetPool& rSourcePool); void CopyCellSheets(SdStyleSheetPool& rSourcePool); void CopyTableStyles(SdStyleSheetPool const & rSourcePool); - void CopyCellSheets(SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets); - void RenameAndCopyGraphicSheets(SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets, OUString const &rRenameSuffix); + void CopyCellSheets(SdStyleSheetPool& rSourcePool, StyleSheetCopyResultVector& rCreatedSheets); + void RenameAndCopyGraphicSheets(SdStyleSheetPool& rSourcePool, StyleSheetCopyResultVector& rCreatedSheets, OUString const &rRenameSuffix); void CreatePseudosIfNecessary(); void UpdateStdNames(); @@ -117,8 +117,8 @@ public: private: void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily ); - void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets ); - void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets, const OUString &rRenameSuffix ); + void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, StyleSheetCopyResultVector& rCreatedSheets ); + void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, StyleSheetCopyResultVector& rCreatedSheets, const OUString &rRenameSuffix ); virtual SfxStyleSheetBase* Create(const OUString& rName, SfxStyleFamily eFamily, SfxStyleSearchBits nMask) override; diff --git a/sd/inc/stlsheet.hxx b/sd/inc/stlsheet.hxx index ae21105070a8..e8e0842e00c7 100644 --- a/sd/inc/stlsheet.hxx +++ b/sd/inc/stlsheet.hxx @@ -155,6 +155,19 @@ private: typedef std::vector< rtl::Reference< SdStyleSheet > > SdStyleSheetVector; +struct StyleSheetCopyResult +{ + rtl::Reference<SdStyleSheet> m_xStyleSheet; + bool m_bCreatedByCopy; + StyleSheetCopyResult(SdStyleSheet* pStyleSheet, bool bCreatedByCopy) + : m_xStyleSheet(pStyleSheet) + , m_bCreatedByCopy(bCreatedByCopy) + { + } +}; + +typedef std::vector<StyleSheetCopyResult> StyleSheetCopyResultVector; + #endif // INCLUDED_SD_INC_STLSHEET_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |