Kaydet (Commit) e8dc04cb authored tarafından Noel Grandin's avatar Noel Grandin

tdf#125339 Base, Table is deleted after accessing the table

regression from
    commit 306758ab
    Date:   Fri Apr 5 15:40:27 2019 +0200
    tdf#117066 Saving ODT document with ~1500 bookmarks is slow, part 5
Before the above commit, we could have multiple child items with the
same name. Restore that behaviour, while keeping the fast lookup, by
using a std::unordered_map<OUString, std::vector<...

Also remove name from SotElement_Impl so there is no chance of the name
in the key of the map, and the name in the element getting out of sync.

Change-Id: I65c294ddc409d9b8a7006e4f4338c9a2a4446a92
Reviewed-on: https://gerrit.libreoffice.org/72544
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 3f5f67c6
......@@ -80,8 +80,7 @@ struct OWriteStream_Impl;
struct SotElement_Impl
OUString m_aName;
OUString m_aOriginalName;
OUString m_aOriginalName;
bool m_bIsRemoved;
bool m_bIsInserted;
bool const m_bIsStorage;
......@@ -139,7 +138,7 @@ struct OStorage_Impl
return m_nModifiedListenerCount > 0 && m_pAntiImpl != nullptr;
std::unordered_map<OUString, SotElement_Impl*> m_aChildrenMap;
std::unordered_map<OUString, std::vector<SotElement_Impl*>> m_aChildrenMap;
SotElementVector_Impl m_aDeletedVector;
css::uno::Reference< css::container::XNameContainer > m_xPackageFolder;
......@@ -229,7 +228,6 @@ struct OStorage_Impl
bool bDirect );
SotElement_Impl* FindElement( const OUString& rName );
std::unordered_map<OUString, SotElement_Impl*>::iterator FindElementIt( const OUString& rName );
SotElement_Impl* InsertStream( const OUString& aName, bool bEncr );
void InsertRawStream( const OUString& aName, const css::uno::Reference< css::io::XInputStream >& xInStream );
......@@ -243,7 +241,7 @@ struct OStorage_Impl
css::uno::Sequence< OUString > GetElementNames();
std::unordered_map<OUString, SotElement_Impl*>::iterator RemoveElement( std::unordered_map<OUString, SotElement_Impl*>::iterator pElement );
void RemoveElement( OUString const & rName, SotElement_Impl* pElement );
static void ClearElement( SotElement_Impl* pElement );
/// @throws css::embed::InvalidStorageException
......@@ -262,7 +260,7 @@ struct OStorage_Impl
void RemoveStreamRelInfo( const OUString& aOriginalName );
void CreateRelStorage();
void CommitStreamRelInfo( SotElement_Impl const * pStreamElement );
void CommitStreamRelInfo( const OUString& rName, SotElement_Impl const * pStreamElement );
css::uno::Reference< css::io::XInputStream > GetRelInfoStreamForName( const OUString& aName );
void CommitRelInfo( const css::uno::Reference< css::container::XNameContainer >& xNewPackageFolder );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment