Revert "Related: tdf#147448 Scope owning mutex before it gets destroyed"
This reverts commit dcd042c6f28276d707af409a87a1a4380398e9b0.
Reason for revert:
Revisiting, it was wrong to put that protector in its own scope because the actual mutex lock is only held in its ctor and it does SetAllowRefresh(true) in dtor, so while it exists it prevents other refresh timers to execute.
Change-Id: I058c1359c19971dba59a9273a7a8cddd77ece37f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130556
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 6cfae15..9a3a2fb 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -337,11 +337,7 @@ ScDocument::~ScDocument()
if ( pRefreshTimerControl )
{ // To be sure there isn't anything running do it with a protector,
// this ensures also that nothing needs the control anymore.
{
// Use a scope on its own because it is undefined behaviour if a
// mutex is destroyed while still owned.
ScRefreshTimerProtector aProt( GetRefreshTimerControlAddress() );
}
ScRefreshTimerProtector aProt( GetRefreshTimerControlAddress() );
pRefreshTimerControl.reset();
}