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@redhat.com>
This commit is contained in:
Stephan Bergmann
2018-06-27 10:57:59 +02:00
parent ee45d881ef
commit 6ebc026e34
+4 -1
View File
@@ -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.