summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2018-01-19 21:00:16 +0100
committerMichael Stahl <mstahl@redhat.com>2018-01-22 09:32:52 +0100
commit0a0cf00b173d3207ae167b256e496d005615f1ee (patch)
tree3c3a9b12e6bdb8ef1e72a28e0a7bf517d2da7ec5
parentboost: upgrade to release 1.66.0 (diff)
downloadcore-0a0cf00b173d3207ae167b256e496d005615f1ee.tar.gz
core-0a0cf00b173d3207ae167b256e496d005615f1ee.zip
C++17 deprecated std::shared_ptr::unique()
Most of these calls are in assertions, and the ones that aren't should be guarded by SolarMutex, so the thread safety concerns that caused unique() to be deprecated don't look relevant, so use use_count(), which oddly enough isn't deprecated. Change-Id: Ia166615af6c3ce85145c391752669c7461bd35fb Reviewed-on: https://gerrit.libreoffice.org/48222 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sd/source/ui/framework/factories/BasicViewFactory.cxx2
-rw-r--r--sd/source/ui/slidesorter/model/SlideSorterModel.cxx2
-rw-r--r--sd/source/ui/slidesorter/view/SlideSorterView.cxx2
-rw-r--r--sd/source/ui/tools/SdGlobalResourceContainer.cxx4
-rw-r--r--sw/source/core/doc/docbm.cxx2
-rw-r--r--sw/source/core/ole/ndole.cxx2
-rw-r--r--vcl/opengl/salbmp.cxx2
-rw-r--r--vcl/opengl/texture.cxx2
-rw-r--r--vcl/source/app/settings.cxx15
-rw-r--r--vcl/source/gdi/bitmap.cxx2
-rw-r--r--vcl/source/gdi/graph.cxx2
11 files changed, 21 insertions, 16 deletions
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index e7fd347f8699..34ac40176dce 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -122,7 +122,7 @@ void SAL_CALL BasicViewFactory::disposing()
// ViewShellContainer::const_iterator iView;
for (iView=mpViewShellContainer->begin(); iView!=mpViewShellContainer->end(); ++iView)
{
- OSL_ASSERT((*iView)->mpViewShell.unique());
+ OSL_ASSERT((*iView)->mpViewShell.use_count() == 1);
}
mpViewShellContainer.reset();
}
diff --git a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
index bdf10c4afdb7..2d22459ed1e7 100644
--- a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
+++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
@@ -323,7 +323,7 @@ void SlideSorterModel::ClearDescriptorList()
{
if (iDescriptor->get() != nullptr)
{
- if ( ! iDescriptor->unique())
+ if (iDescriptor->use_count() > 1)
{
SAL_INFO(
"sd.sls",
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index 5ebdb0d4849f..0a4998df6f22 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -198,7 +198,7 @@ void SlideSorterView::Dispose()
// Deletion of the objects and the page will be done in SdrModel
// destructor (as long as objects and pages are added)
- OSL_ASSERT(mpLayeredDevice.unique());
+ OSL_ASSERT(mpLayeredDevice.use_count() == 1);
mpLayeredDevice.reset();
mbIsDisposed = true;
diff --git a/sd/source/ui/tools/SdGlobalResourceContainer.cxx b/sd/source/ui/tools/SdGlobalResourceContainer.cxx
index f04b5f4a4c99..a8c07915b54c 100644
--- a/sd/source/ui/tools/SdGlobalResourceContainer.cxx
+++ b/sd/source/ui/tools/SdGlobalResourceContainer.cxx
@@ -176,12 +176,12 @@ SdGlobalResourceContainer::~SdGlobalResourceContainer()
iSharedResource != mpImpl->maSharedResources.rend();
++iSharedResource)
{
- if ( ! iSharedResource->unique())
+ if (iSharedResource->use_count() > 1)
{
SdGlobalResource* pResource = iSharedResource->get();
SAL_INFO(
"sd.tools", pResource << " " << iSharedResource->use_count());
- DBG_ASSERT(iSharedResource->unique(),
+ DBG_ASSERT(iSharedResource->use_count() == 1,
"SdGlobalResource still held in ~SdGlobalResourceContainer");
}
}
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 87822dce5aa7..45618432f67d 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -994,7 +994,7 @@ namespace sw { namespace mark
for(iterator_t pBkmk = m_vAllMarks.begin();
pBkmk != m_vAllMarks.end();
++pBkmk)
- OSL_ENSURE( pBkmk->unique(),
+ OSL_ENSURE( pBkmk->use_count() == 1,
"<MarkManager::clearAllMarks(..)> - a Bookmark is still in use.");
#endif
m_vAllMarks.clear();
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index 7d91b8ce96d3..9960fd863f3c 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -1174,7 +1174,7 @@ void SwOLELRUCache::RemoveObj( SwOLEObj& rObj )
}
if (m_OleObjects.empty())
{
- if (g_pOLELRU_Cache.unique()) // test that we're not in InsertObj()
+ if (g_pOLELRU_Cache.use_count() == 1) // test that we're not in InsertObj()
{
g_pOLELRU_Cache.reset();
}
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index 93fcf0e670c2..4127c46a509b 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -756,7 +756,7 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( BitmapAccessMode nMode )
}
// mpUserBuffer must be unique when we are doing the write access
- if (nMode == BitmapAccessMode::Write && mpUserBuffer && !mpUserBuffer.unique())
+ if (nMode == BitmapAccessMode::Write && mpUserBuffer && mpUserBuffer.use_count() > 1)
{
std::shared_ptr<sal_uInt8> aBuffer(mpUserBuffer);
diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx
index 615b7c6d9db8..bed1171e5604 100644
--- a/vcl/opengl/texture.cxx
+++ b/vcl/opengl/texture.cxx
@@ -321,7 +321,7 @@ OpenGLTexture::~OpenGLTexture()
bool OpenGLTexture::IsUnique() const
{
- return !mpImpl || mpImpl.unique();
+ return !mpImpl || (mpImpl.use_count() == 1);
}
GLuint OpenGLTexture::Id() const
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 5429c20a400c..883bde42e80a 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -488,7 +488,8 @@ MouseSettings::~MouseSettings()
void MouseSettings::CopyData()
{
// copy if other references exist
- if ( ! mxData.unique() ) {
+ if (mxData.use_count() > 1)
+ {
mxData = std::make_shared<ImplMouseData>(*mxData);
}
}
@@ -2249,7 +2250,8 @@ Color StyleSettings::GetSeparatorColor() const
void StyleSettings::CopyData()
{
// copy if other references exist
- if ( ! mxData.unique() ) {
+ if (mxData.use_count() > 1)
+ {
mxData = std::make_shared<ImplStyleData>(*mxData);
}
}
@@ -2552,7 +2554,8 @@ void MiscSettings::SetEnableATToolSupport( bool bEnable )
void MiscSettings::SetEnableLocalizedDecimalSep( bool bEnable )
{
// copy if other references exist
- if ( ! mxData.unique() ) {
+ if (mxData.use_count() > 1)
+ {
mxData = std::make_shared<ImplMiscData>(*mxData);
}
mxData->mbEnableLocalizedDecimalSep = bEnable;
@@ -2611,7 +2614,8 @@ void
HelpSettings::SetTipTimeout( sal_uLong nTipTimeout )
{
// copy if other references exist
- if ( ! mxData.unique() ) {
+ if (mxData.use_count() > 1)
+ {
mxData = std::make_shared<ImplHelpData>(*mxData);
}
mxData->mnTipTimeout = nTipTimeout;
@@ -2693,7 +2697,8 @@ AllSettings::~AllSettings()
void AllSettings::CopyData()
{
// copy if other references exist
- if ( ! mxData.unique() ) {
+ if (mxData.use_count() > 1)
+ {
mxData = std::make_shared<ImplAllSettingsData>(*mxData);
}
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index f8b9701350f1..31f60297a8bc 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -298,7 +298,7 @@ BitmapChecksum Bitmap::GetChecksum() const
void Bitmap::ImplMakeUnique()
{
- if (mxImpBmp && !mxImpBmp.unique())
+ if (mxImpBmp && mxImpBmp.use_count() > 1)
{
std::shared_ptr<ImpBitmap> xOldImpBmp = mxImpBmp;
mxImpBmp.reset(new ImpBitmap);
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index 6b1587a36194..0505bf6e1172 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -244,7 +244,7 @@ Graphic::Graphic( const css::uno::Reference< css::graphic::XGraphic >& rxGraphic
void Graphic::ImplTestRefCount()
{
- if (!mxImpGraphic.unique())
+ if (mxImpGraphic.use_count() > 1)
{
mxImpGraphic.reset(new ImpGraphic(*mxImpGraphic));
}