[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sfx2/source
Szymon KÅ‚os (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 4 12:59:15 UTC 2020
sc/inc/document.hxx | 11 +++--------
sc/source/core/data/documen2.cxx | 9 ++-------
sc/source/core/data/document.cxx | 19 +++++++++++++------
sfx2/source/notebookbar/SfxNotebookBar.cxx | 11 +++++++----
4 files changed, 25 insertions(+), 25 deletions(-)
New commits:
commit adb901ca11afa5a153ecd433375b9ab1dfc2fd03
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Aug 3 09:40:31 2020 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Aug 4 14:58:34 2020 +0200
notebookbar: control early init per view
Change-Id: I9b743bc6d62256289549cd8002b76bcb918222b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99986
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
(cherry picked from commit fddfeb653dfd5dd73cbccb4433678d397f092df9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99921
Tested-by: Jenkins
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index dd79e65fa3ec..16a0608f7b30 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -30,6 +30,7 @@
#include <framework/addonsoptions.hxx>
#include <vcl/NotebookBarAddonsMerger.hxx>
#include <vector>
+#include <map>
#include <vcl/WeldedTabbedNotebookbar.hxx>
using namespace sfx2;
@@ -366,13 +367,16 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
if ((!sFile.isEmpty() && bChangedFile) || !pNotebookBar || !pNotebookBar->IsVisible()
|| bReloadNotebookbar || comphelper::LibreOfficeKit::isActive())
{
+ const SfxViewShell* pViewShell = SfxViewShell::Current();
+
// Notebookbar was loaded too early what caused:
// * in LOK: Paste Special feature was incorrectly initialized
// Skip first request so Notebookbar will be initialized after document was loaded
- static bool bSkipFirstInit = true;
- if (comphelper::LibreOfficeKit::isActive() && bSkipFirstInit)
+ static std::map<const void*, bool> bSkippedFirstInit;
+ if (comphelper::LibreOfficeKit::isActive()
+ && bSkippedFirstInit.find(pViewShell) == bSkippedFirstInit.end())
{
- bSkipFirstInit = false;
+ bSkippedFirstInit[pViewShell] = true;
return false;
}
@@ -393,7 +397,6 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
pNotebookBar = pSysWindow->GetNotebookBar();
pNotebookBar->Show();
- const SfxViewShell* pViewShell = SfxViewShell::Current();
bool hasWeldedWrapper = m_pNotebookBarWeldedWrapper.find(pViewShell) != m_pNotebookBarWeldedWrapper.end();
if ((!hasWeldedWrapper || bReloadNotebookbar) && pNotebookBar->IsWelded())
commit 7959953e990b9fc10dbffd5a92553037d2b419c2
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 4 11:23:16 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 4 14:58:14 2020 +0200
fix leak in CppunitTest_sc_ucalc
Change-Id: Iee5f4bfcd8ad90d37e787d225928a5ae7b269f2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100048
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index f2ceca43fcbf..69e0b06a6cab 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -296,14 +296,11 @@ const sal_uInt8 SC_DDE_IGNOREMODE = 255; /// For usage in FindDdeLink()
// During threaded calculation fields being mutated are kept in this struct
struct ScDocumentThreadSpecific
{
- ScRecursionHelper* pRecursionHelper; // information for recursive and iterative cell formulas
+ std::unique_ptr<ScRecursionHelper> xRecursionHelper; // information for recursive and iterative cell formulas
ScInterpreterContext* pContext; // references the context passed around for easier access
- ScDocumentThreadSpecific()
- : pRecursionHelper(nullptr)
- , pContext(nullptr)
- {
- }
+ ScDocumentThreadSpecific();
+ ~ScDocumentThreadSpecific();
// To be called in the thread at start
static void SetupFromNonThreadedData(const ScDocumentThreadSpecific& rNonThreadedData);
@@ -2225,8 +2222,6 @@ private:
DECL_LINK(TrackTimeHdl, Timer *, void);
- static ScRecursionHelper* CreateRecursionHelperInstance();
-
/** Adjust a range to available sheets.
Used to start and stop listening on a sane range. Both o_rRange and
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 9b966c8d5cf5..e4413853aa71 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -387,8 +387,8 @@ ScDocument::~ScDocument()
mxPoolHelper.clear();
pScriptTypeData.reset();
- delete maNonThreaded.pRecursionHelper;
- delete maThreadSpecific.pRecursionHelper;
+ maNonThreaded.xRecursionHelper.reset();
+ maThreadSpecific.xRecursionHelper.reset();
pPreviewFont.reset();
SAL_WARN_IF( pAutoNameCache, "sc.core", "AutoNameCache still set in dtor" );
@@ -1148,11 +1148,6 @@ void ScDocument::DisposeFieldEditEngine(std::unique_ptr<ScFieldEditEngine>& rpEd
rpEditEngine.reset();
}
-ScRecursionHelper* ScDocument::CreateRecursionHelperInstance()
-{
- return new ScRecursionHelper;
-}
-
ScLookupCache & ScDocument::GetLookupCache( const ScRange & rRange, ScInterpreterContext* pContext )
{
ScLookupCache* pCache = nullptr;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 32154717bd29..1b998a0da97b 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -85,6 +85,7 @@
#include <compressedarray.hxx>
#include <docsh.hxx>
#include <brdcst.hxx>
+#include <recursionhelper.hxx>
#include <formula/vectortoken.hxx>
@@ -6809,15 +6810,15 @@ ScRecursionHelper& ScDocument::GetRecursionHelper()
{
if (!IsThreadedGroupCalcInProgress())
{
- if (!maNonThreaded.pRecursionHelper)
- maNonThreaded.pRecursionHelper = CreateRecursionHelperInstance();
- return *maNonThreaded.pRecursionHelper;
+ if (!maNonThreaded.xRecursionHelper)
+ maNonThreaded.xRecursionHelper = std::make_unique<ScRecursionHelper>();
+ return *maNonThreaded.xRecursionHelper;
}
else
{
- if (!maThreadSpecific.pRecursionHelper)
- maThreadSpecific.pRecursionHelper = CreateRecursionHelperInstance();
- return *maThreadSpecific.pRecursionHelper;
+ if (!maThreadSpecific.xRecursionHelper)
+ maThreadSpecific.xRecursionHelper = std::make_unique<ScRecursionHelper>();
+ return *maThreadSpecific.xRecursionHelper;
}
}
@@ -6832,6 +6833,12 @@ void ScDocumentThreadSpecific::MergeBackIntoNonThreadedData(ScDocumentThreadSpec
// What about recursion helper and lookup cache?
}
+ScDocumentThreadSpecific::ScDocumentThreadSpecific()
+ : pContext(nullptr)
+{}
+
+ScDocumentThreadSpecific::~ScDocumentThreadSpecific() {}
+
void ScDocument::SetupFromNonThreadedContext(ScInterpreterContext& /*threadedContext*/, int /*threadNumber*/)
{
// lookup cache is now only in pooled ScInterpreterContext's
More information about the Libreoffice-commits
mailing list