Resolves: tdf#147448 ScRefreshTimerControl mutex must be std::recursive_mutex

ScRefreshTimer::Invoke() locks the mutex and subsequent nested
locks are attempted in ScDocShell::ConvertFrom() and
ScDocShellModificator ctor by ScRefreshTimerProtector.

A std::mutex must not be owned by the calling thread when a lock
is attempted, otherwise even deadlocks may occur, as was the case
here. This is exactly the difference of std::recursive_mutex.

Likely a regression from

    commit 287680683c
    CommitDate: Mon Aug 2 12:17:07 2021 +0200

        osl::Mutex->std::mutex in ScRefreshTimer

Change-Id: Iaa0f1da2b4b9616e9627d8d0001775f554756048
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130573
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
This commit is contained in:
Eike Rathke
2022-02-26 02:57:58 +01:00
parent 974bf22680
commit 4361ee2585
+3 -3
View File
@@ -28,14 +28,14 @@
class ScRefreshTimerControl
{
std::mutex aMutex;
sal_uInt16 nBlockRefresh;
std::recursive_mutex aMutex;
sal_uInt16 nBlockRefresh;
public:
ScRefreshTimerControl() : nBlockRefresh(0) {}
void SetAllowRefresh( bool b );
bool IsRefreshAllowed() const { return !nBlockRefresh; }
std::mutex& GetMutex() { return aMutex; }
std::recursive_mutex& GetMutex() { return aMutex; }
};
class ScRefreshTimer : public AutoTimer