[Libreoffice-commits] core.git: include/salhelper

Stephan Bergmann sbergman at redhat.com
Wed Jun 27 08:58:22 UTC 2018


 include/salhelper/singletonref.hxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 6ebc026e34d0c119067e7dfbad8d932f92844760
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Jun 27 08:33:50 2018 +0200

    salhelper::SingletonRef copy ctor is broken, mark as deleted
    
    If that (implicitly defined) ctor had ever been used, it would have failed to
    increment m_nRef, so could have caused m_pInstance to be deleted too early.  So
    better mark it as deleted.  (LO itself apparently didn't call it.  If 3rd party
    code would want to call it after all, it could be changed from deleted to
    properly user-provided, incrementing m_nRef, in the future.)
    
    The implicitly defined copy assignment op happens to already do the right thing,
    and /is/ used, e.g., during
    
    >         m_aNode = _rhs.m_aNode;
    
    in DriversConfig::operator= (connectivity/source/commontools/DriversConfig.cxx).
    Mark it as defaulted to avoid -Wdeprecated-copy with GCC trunk towards GCC 9.
    
    Change-Id: I527123d9de837c311d30a270feb09dc173d9f411
    Reviewed-on: https://gerrit.libreoffice.org/56512
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/include/salhelper/singletonref.hxx b/include/salhelper/singletonref.hxx
index 45f685835d54..9d9747ee70ae 100644
--- a/include/salhelper/singletonref.hxx
+++ b/include/salhelper/singletonref.hxx
@@ -131,6 +131,9 @@ class SingletonRef
             // <- GLOBAL SAFE
         }
 
+#if defined LIBO_INTERNAL_ONLY
+        SingletonRef & operator =(SingletonRef const &) = default;
+#endif
 
         /** @short  Allows rSingle->someBodyOp().
          */
@@ -157,7 +160,7 @@ class SingletonRef
     // helper
 
     private:
-
+        SingletonRef(SingletonRef &) SAL_DELETED_FUNCTION;
 
         /** @short  creates an own mutex for guarding static contents.
 


More information about the Libreoffice-commits mailing list