[Libreoffice-commits] core.git: libreofficekit/source vcl/source vcl/unx
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jun 20 05:51:22 UTC 2019
libreofficekit/source/gtk/lokdocview.cxx | 14 +++++++-------
vcl/source/graphic/Manager.cxx | 14 +++++++-------
vcl/source/uitest/uno/uiobject_uno.cxx | 4 ++--
vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx | 2 +-
4 files changed, 17 insertions(+), 17 deletions(-)
New commits:
commit 9376f65a26240441bf9dd6ae1f69886dc9fa60fa
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Jun 19 22:28:20 2019 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Jun 20 07:50:19 2019 +0200
Consolidate on C++17 std::scoped_lock instead of std::lock_guard
...where scoped_lock was originally meant as a transparent generalization of
lock_guard, but eventually had to supersede it under a new name, for backwards-
compatibility reasons, see
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0156r2.html> "Variadic
lock_guard (Rev. 5)" and
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0488r0.pdf> "WG21
Working Paper, NB Comments, ISO/IEC CD 14882".
Change-Id: Ie58909f63beec5939601183d6bcda3bc638d5747
Reviewed-on: https://gerrit.libreoffice.org/74382
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index b55ca470e253..3f43a1487502 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -2186,7 +2186,7 @@ setGraphicSelectionInThread(gpointer data)
LOKDocViewPrivate& priv = getPrivate(pDocView);
LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
- std::lock_guard<std::mutex> aGuard(g_aLOKMutex);
+ std::scoped_lock<std::mutex> aGuard(g_aLOKMutex);
std::stringstream ss;
ss << "lok::Document::setView(" << priv->m_nViewId << ")";
g_info("%s", ss.str().c_str());
@@ -2210,7 +2210,7 @@ setClientZoomInThread(gpointer data)
LOKDocViewPrivate& priv = getPrivate(pDocView);
LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
- std::lock_guard<std::mutex> aGuard(g_aLOKMutex);
+ std::scoped_lock<std::mutex> aGuard(g_aLOKMutex);
priv->m_pDocument->pClass->setClientZoom(priv->m_pDocument,
pLOEvent->m_nTilePixelWidth,
pLOEvent->m_nTilePixelHeight,
@@ -2226,7 +2226,7 @@ postMouseEventInThread(gpointer data)
LOKDocViewPrivate& priv = getPrivate(pDocView);
LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
- std::lock_guard<std::mutex> aGuard(g_aLOKMutex);
+ std::scoped_lock<std::mutex> aGuard(g_aLOKMutex);
std::stringstream ss;
ss << "lok::Document::setView(" << priv->m_nViewId << ")";
g_info("%s", ss.str().c_str());
@@ -2255,7 +2255,7 @@ openDocumentInThread (gpointer data)
LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task));
LOKDocViewPrivate& priv = getPrivate(pDocView);
- std::lock_guard<std::mutex> aGuard(g_aLOKMutex);
+ std::scoped_lock<std::mutex> aGuard(g_aLOKMutex);
if ( priv->m_pDocument )
{
priv->m_pDocument->pClass->destroy( priv->m_pDocument );
@@ -2306,7 +2306,7 @@ setPartmodeInThread(gpointer data)
LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
int nPartMode = pLOEvent->m_nPartMode;
- std::lock_guard<std::mutex> aGuard(g_aLOKMutex);
+ std::scoped_lock<std::mutex> aGuard(g_aLOKMutex);
std::stringstream ss;
ss << "lok::Document::setView(" << priv->m_nViewId << ")";
g_info("%s", ss.str().c_str());
@@ -2329,7 +2329,7 @@ setEditInThread(gpointer data)
else if (priv->m_bEdit && !bEdit)
{
g_info("lok_doc_view_set_edit: leaving edit mode");
- std::lock_guard<std::mutex> aGuard(g_aLOKMutex);
+ std::scoped_lock<std::mutex> aGuard(g_aLOKMutex);
std::stringstream ss;
ss << "lok::Document::setView(" << priv->m_nViewId << ")";
g_info("%s", ss.str().c_str());
@@ -2349,7 +2349,7 @@ postCommandInThread (gpointer data)
LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
LOKDocViewPrivate& priv = getPrivate(pDocView);
- std::lock_guard<std::mutex> aGuard(g_aLOKMutex);
+ std::scoped_lock<std::mutex> aGuard(g_aLOKMutex);
std::stringstream ss;
ss << "lok::Document::setView(" << priv->m_nViewId << ")";
g_info("%s", ss.str().c_str());
diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx
index 7a03f85468dd..3ddec0ae280b 100644
--- a/vcl/source/graphic/Manager.cxx
+++ b/vcl/source/graphic/Manager.cxx
@@ -76,7 +76,7 @@ Manager::Manager()
void Manager::reduceGraphicMemory()
{
- std::lock_guard<std::recursive_mutex> aGuard(maMutex);
+ std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
for (ImpGraphic* pEachImpGraphic : m_pImpGraphicList)
{
@@ -108,7 +108,7 @@ sal_Int64 Manager::getGraphicSizeBytes(const ImpGraphic* pImpGraphic)
IMPL_LINK(Manager, SwapOutTimerHandler, Timer*, pTimer, void)
{
- std::lock_guard<std::recursive_mutex> aGuard(maMutex);
+ std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
pTimer->Stop();
reduceGraphicMemory();
@@ -118,7 +118,7 @@ IMPL_LINK(Manager, SwapOutTimerHandler, Timer*, pTimer, void)
void Manager::registerGraphic(const std::shared_ptr<ImpGraphic>& pImpGraphic,
OUString const& /*rsContext*/)
{
- std::lock_guard<std::recursive_mutex> aGuard(maMutex);
+ std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
// make some space first
if (mnUsedSize > mnMemoryLimit)
@@ -149,7 +149,7 @@ void Manager::registerGraphic(const std::shared_ptr<ImpGraphic>& pImpGraphic,
void Manager::unregisterGraphic(ImpGraphic* pImpGraphic)
{
- std::lock_guard<std::recursive_mutex> aGuard(maMutex);
+ std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
mnUsedSize -= getGraphicSizeBytes(pImpGraphic);
m_pImpGraphicList.erase(pImpGraphic);
@@ -213,21 +213,21 @@ std::shared_ptr<ImpGraphic> Manager::newInstance(const GraphicExternalLink& rGra
void Manager::swappedIn(const ImpGraphic* pImpGraphic)
{
- std::lock_guard<std::recursive_mutex> aGuard(maMutex);
+ std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
mnUsedSize += getGraphicSizeBytes(pImpGraphic);
}
void Manager::swappedOut(const ImpGraphic* pImpGraphic)
{
- std::lock_guard<std::recursive_mutex> aGuard(maMutex);
+ std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
mnUsedSize -= getGraphicSizeBytes(pImpGraphic);
}
void Manager::changeExisting(const ImpGraphic* pImpGraphic, sal_Int64 nOldSizeBytes)
{
- std::lock_guard<std::recursive_mutex> aGuard(maMutex);
+ std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
mnUsedSize -= nOldSizeBytes;
mnUsedSize += getGraphicSizeBytes(pImpGraphic);
diff --git a/vcl/source/uitest/uno/uiobject_uno.cxx b/vcl/source/uitest/uno/uiobject_uno.cxx
index 0b68a5d1cbce..283970569a0e 100644
--- a/vcl/source/uitest/uno/uiobject_uno.cxx
+++ b/vcl/source/uitest/uno/uiobject_uno.cxx
@@ -28,7 +28,7 @@ UIObjectUnoObj::UIObjectUnoObj(std::unique_ptr<UIObject> pObj):
UIObjectUnoObj::~UIObjectUnoObj()
{
{
- std::lock_guard<std::mutex> lk3(mMutex);
+ std::scoped_lock<std::mutex> lk3(mMutex);
}
SolarMutexGuard aGuard;
mpObj.reset();
@@ -46,7 +46,7 @@ css::uno::Reference<css::ui::test::XUIObject> SAL_CALL UIObjectUnoObj::getChild(
IMPL_LINK_NOARG(UIObjectUnoObj, NotifyHdl, Timer*, void)
{
- std::lock_guard<std::mutex> lk(mMutex);
+ std::scoped_lock<std::mutex> lk(mMutex);
mReady = true;
cv.notify_all();
}
diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx
index a9584b11fcd2..b1a8770c5165 100644
--- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx
+++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx
@@ -108,7 +108,7 @@ public:
while (true)
{
// only let one thread read at any given time
- std::lock_guard<std::mutex> lock(m_mutex);
+ std::scoped_lock<std::mutex> lock(m_mutex);
// check if we need to read (and potentially wait) a response ID
if (m_incomingResponse == 0)
More information about the Libreoffice-commits
mailing list