package/source/xstor/xstorage.cxx |   12 +++++++-----
 package/source/xstor/xstorage.hxx |   16 +---------------
 2 files changed, 8 insertions(+), 20 deletions(-)

New commits:
commit 59becee62d1601ce57771a982b1f0cf2f620f1e9
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Feb 5 11:38:47 2026 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Wed Feb 11 12:24:21 2026 +0100

    use more concrete UNO in OStorage_Impl
    
    Change-Id: Ifbd038e604d4c88a53dd544e655b0195bc2a0065
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198906
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/package/source/xstor/xstorage.cxx 
b/package/source/xstor/xstorage.cxx
index 77f9c5eb8144..e5643772743d 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -262,10 +262,10 @@ OStorage_Impl::~OStorage_Impl()
         {
             for ( auto& rStorage : m_aReadOnlyWrapVector )
             {
-                uno::Reference< embed::XStorage > xTmp = rStorage.m_xWeakRef;
+                rtl::Reference< OStorage > xTmp = rStorage;
                 if ( xTmp.is() )
                     try {
-                        rStorage.m_pPointer->InternalDispose( false );
+                        xTmp->InternalDispose( false );
                     } catch( const uno::Exception& )
                     {
                         TOOLS_INFO_EXCEPTION("package.xstor", "Quiet 
exception");
@@ -342,11 +342,13 @@ void OStorage_Impl::RemoveReadOnlyWrap( const OStorage& 
aStorage )
     for ( StorageHoldersType::iterator pStorageIter = 
m_aReadOnlyWrapVector.begin();
       pStorageIter != m_aReadOnlyWrapVector.end();)
     {
-        uno::Reference< embed::XStorage > xTmp = pStorageIter->m_xWeakRef;
-        if ( !xTmp.is() || pStorageIter->m_pPointer == &aStorage )
+        rtl::Reference< OStorage > xTmp = *pStorageIter;
+        if ( !xTmp )
+            pStorageIter = m_aReadOnlyWrapVector.erase(pStorageIter);
+        else if ( xTmp && xTmp.get() == &aStorage )
         {
             try {
-                pStorageIter->m_pPointer->InternalDispose( false );
+                xTmp->InternalDispose( false );
             } catch( const uno::Exception& )
             {
                 TOOLS_INFO_EXCEPTION("package.xstor", "Quiet exception");
diff --git a/package/source/xstor/xstorage.hxx 
b/package/source/xstor/xstorage.hxx
index 067893a274fb..91f08f5e467b 100644
--- a/package/source/xstor/xstorage.hxx
+++ b/package/source/xstor/xstorage.hxx
@@ -96,18 +96,10 @@ public:
 
 class OStorage;
 
-struct StorageHolder_Impl
-{
-    OStorage* m_pPointer;
-    css::uno::WeakReference< css::embed::XStorage > m_xWeakRef;
-
-    explicit inline StorageHolder_Impl( OStorage* pStorage );
-};
-
 class SwitchablePersistenceStream;
 struct OStorage_Impl
 {
-    typedef std::vector<StorageHolder_Impl> StorageHoldersType;
+    typedef std::vector<unotools::WeakReference< OStorage >> 
StorageHoldersType;
 
     rtl::Reference<comphelper::RefCountedMutex> m_xMutex;
 
@@ -535,12 +527,6 @@ public:
     virtual css::uno::Reference< css::embed::XExtendedStorageStream > SAL_CALL 
openEncryptedStreamByHierarchicalName( const OUString& sStreamName, ::sal_Int32 
nOpenMode, const css::uno::Sequence< css::beans::NamedValue >& aEncryptionData 
) override;
 };
 
-StorageHolder_Impl::StorageHolder_Impl( OStorage* pStorage )
-: m_pPointer( pStorage )
-, m_xWeakRef( css::uno::Reference< css::embed::XStorage >( pStorage ) )
-{
-}
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to