sc/source/ui/docshell/datastream.cxx | 17 ++++++++++++----- sc/source/ui/inc/datastream.hxx | 3 +++ 2 files changed, 15 insertions(+), 5 deletions(-)
New commits: commit 93098819ccbc4cf7448b429e13d36c170f38ac39 Author: Matúš Kukan <matus.ku...@collabora.com> Date: Mon Nov 25 10:44:08 2013 +0100 datastreams: do not hang when closing the link Change-Id: Ib38472849d7b56bf3013f65d84f1b4cfbd91b2d0 diff --git a/sc/source/ui/docshell/datastream.cxx b/sc/source/ui/docshell/datastream.cxx index 8064bc8..79d637c 100644 --- a/sc/source/ui/docshell/datastream.cxx +++ b/sc/source/ui/docshell/datastream.cxx @@ -54,9 +54,9 @@ private: TimeValue const aTime = {0, 100000}; maStart.wait(); maStart.reset(); - if (!mbTerminate) - while (mpDataStream->ImportData()) - wait(aTime); + while (!mbTerminate && mpDataStream->ImportData()) + wait(aTime); + mpDataStream->maMakeSureTheThreadStopped.set(); }; } }; @@ -238,8 +238,7 @@ DataStream::DataStream(ScDocShell *pShell, const OUString& rURL, const ScRange& DataStream::~DataStream() { - if (mbRunning) - Stop(); + Stop(); mxThread->mbTerminate = true; mxThread->maStart.set(); mxThread->join(); @@ -309,6 +308,8 @@ void DataStream::Stop() if (!mbRunning) return; mbRunning = false; + SolarMutexReleaser aAllowTheThreadToStop; + maMakeSureTheThreadStopped.wait(); mpScDocument->EnableUndo(mbIsUndoEnabled); } @@ -397,6 +398,12 @@ bool DataStream::ImportData() return mbRunning; } +void DataStream::Closed() +{ + Stop(); + SvBaseLink::Closed(); +} + sfx2::SvBaseLink::UpdateResult DataStream::DataChanged( const OUString& , const css::uno::Any& ) { diff --git a/sc/source/ui/inc/datastream.hxx b/sc/source/ui/inc/datastream.hxx index 9dd7cb7..ec355fa 100644 --- a/sc/source/ui/inc/datastream.hxx +++ b/sc/source/ui/inc/datastream.hxx @@ -9,6 +9,7 @@ #include <sal/config.h> +#include <osl/conditn.hxx> #include <rtl/ref.hxx> #include <rtl/ustring.hxx> #include <sfx2/lnkbase.hxx> @@ -37,6 +38,7 @@ class DataStream : boost::noncopyable, public sfx2::SvBaseLink public: enum MoveEnum { NO_MOVE, RANGE_DOWN, MOVE_DOWN, MOVE_UP }; enum { SCRIPT_STREAM = 1, VALUES_IN_LINE = 2 }; + osl::Condition maMakeSureTheThreadStopped; static void MakeToolbarVisible(ScDocShell *pShell); static void Set(ScDocShell *pShell, const OUString& rURL, const OUString& rRange, @@ -45,6 +47,7 @@ public: DataStream(ScDocShell *pShell, const OUString& rURL, const ScRange& rRange, sal_Int32 nLimit, const OUString& rMove, sal_uInt32 nSettings); virtual ~DataStream() SAL_OVERRIDE; + virtual void Closed() SAL_OVERRIDE; virtual sfx2::SvBaseLink::UpdateResult DataChanged( const OUString& , const css::uno::Any& ) SAL_OVERRIDE; virtual void Edit(Window* , const Link& ) SAL_OVERRIDE;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits