[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Sat Aug 12 19:16:31 UTC 2017
sc/inc/datamapper.hxx | 2 +-
sc/source/ui/dataprovider/csvdataprovider.cxx | 7 +++++++
sc/source/ui/dataprovider/dataprovider.cxx | 15 ++++++++++++++-
sc/source/ui/inc/dataprovider.hxx | 9 +++++++++
4 files changed, 31 insertions(+), 2 deletions(-)
New commits:
commit e07bf6aadb301407add5d4c6fff73b3be8bd63a2
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Aug 12 19:11:02 2017 +0200
external data: avoid deadlock when the thread needs the SolarMutex
Change-Id: I222f2031dbd55515db63b1360c8248ec24e6c89d
Reviewed-on: https://gerrit.libreoffice.org/41092
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/source/ui/dataprovider/csvdataprovider.cxx b/sc/source/ui/dataprovider/csvdataprovider.cxx
index 4e2aea9cffa9..24450e0d4349 100644
--- a/sc/source/ui/dataprovider/csvdataprovider.cxx
+++ b/sc/source/ui/dataprovider/csvdataprovider.cxx
@@ -188,6 +188,7 @@ CSVDataProvider::~CSVDataProvider()
{
if (mxCSVFetchThread.is())
{
+ SolarMutexReleaser aReleaser;
mxCSVFetchThread->join();
}
}
commit 32708687dbb496e6b8d74c806126f0f28a3ac2a2
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Aug 12 19:10:26 2017 +0200
external data: introduce a deterministic mode for the tests
Change-Id: I5804800216bd7d22b89a4e54d3f46cc3520f7c42
Reviewed-on: https://gerrit.libreoffice.org/41091
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/inc/datamapper.hxx b/sc/inc/datamapper.hxx
index b8216b0de0de..55390fc5a39b 100644
--- a/sc/inc/datamapper.hxx
+++ b/sc/inc/datamapper.hxx
@@ -87,7 +87,7 @@ public:
OUString getDBName() const;
void setDBData(ScDBData* pDBData);
- void refresh(ScDocument* pDoc);
+ void refresh(ScDocument* pDoc, bool bDeterministic = false);
};
class SC_DLLPUBLIC ExternalDataMapper
diff --git a/sc/source/ui/dataprovider/csvdataprovider.cxx b/sc/source/ui/dataprovider/csvdataprovider.cxx
index cd87d21c3de4..4e2aea9cffa9 100644
--- a/sc/source/ui/dataprovider/csvdataprovider.cxx
+++ b/sc/source/ui/dataprovider/csvdataprovider.cxx
@@ -202,6 +202,12 @@ void CSVDataProvider::Import()
mpDoc->ResetClip(mpDocument, (SCTAB)0);
mxCSVFetchThread = new CSVFetchThread(*mpDoc, maURL, &maIdle);
mxCSVFetchThread->launch();
+
+ if (mbDeterministic)
+ {
+ SolarMutexReleaser aReleaser;
+ mxCSVFetchThread->join();
+ }
}
IMPL_LINK_NOARG(CSVDataProvider, ImportFinishedHdl, Timer*, void)
diff --git a/sc/source/ui/dataprovider/dataprovider.cxx b/sc/source/ui/dataprovider/dataprovider.cxx
index 119dbdd18e9b..79b936f5d704 100644
--- a/sc/source/ui/dataprovider/dataprovider.cxx
+++ b/sc/source/ui/dataprovider/dataprovider.cxx
@@ -107,7 +107,7 @@ double ExternalDataSource::getUpdateFrequency() const
return mnUpdateFrequency;
}
-void ExternalDataSource::refresh(ScDocument* pDoc)
+void ExternalDataSource::refresh(ScDocument* pDoc, bool bDeterministic)
{
// no DB data available
if (!mpDBDataManager)
@@ -121,6 +121,9 @@ void ExternalDataSource::refresh(ScDocument* pDoc)
if (!mpDataProvider)
return;
+ if (bDeterministic)
+ mpDataProvider->setDeterministic();
+
mpDataProvider->Import();
}
@@ -148,6 +151,16 @@ std::vector<sc::ExternalDataSource>& ExternalDataMapper::getDataSources()
return maDataSources;
}
+DataProvider::DataProvider():
+ mbDeterministic(false)
+{
+}
+
+void DataProvider::setDeterministic()
+{
+ mbDeterministic = true;
+}
+
DataProvider::~DataProvider()
{
}
diff --git a/sc/source/ui/inc/dataprovider.hxx b/sc/source/ui/inc/dataprovider.hxx
index 00fec69638fb..c45adc9616a1 100644
--- a/sc/source/ui/inc/dataprovider.hxx
+++ b/sc/source/ui/inc/dataprovider.hxx
@@ -76,7 +76,14 @@ public:
*/
class DataProvider
{
+protected:
+ /**
+ * If true make the threaded import deterministic for the tests.
+ */
+ bool mbDeterministic;
+
public:
+ DataProvider();
virtual ~DataProvider() = 0;
virtual void Import() = 0;
@@ -84,6 +91,8 @@ public:
virtual const OUString& GetURL() const = 0;
static std::unique_ptr<SvStream> FetchStreamFromURL(const OUString&, OStringBuffer& rBuffer);
+
+ void setDeterministic();
};
class CSVDataProvider : public DataProvider
More information about the Libreoffice-commits
mailing list