diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-20 10:19:25 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-21 13:25:22 -0400 |
commit | 65d026f39cff52c96be95871e16a3d6714203d2e (patch) | |
tree | 604530ace5fc20f01efa4810f0f498de877e524e /sc/source/ui/docshell | |
parent | c28aadc7fcb1858acc2e59a875e0a4c9071681ed (diff) |
cp#1000072: Purge one document shell at a time, to avoid freeze.
Import especially when we have a whole bunch of large-ish documents open
in the background.
Change-Id: I614e6daab3481c09dae47c8407497d77aec40480
Diffstat (limited to 'sc/source/ui/docshell')
-rw-r--r-- | sc/source/ui/docshell/externalrefmgr.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index ded749f222d4..525bbce04c4a 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -2796,19 +2796,20 @@ void ScExternalRefManager::notifyAllLinkListeners(sal_uInt16 nFileId, LinkUpdate void ScExternalRefManager::purgeStaleSrcDocument(sal_Int32 nTimeOut) { - DocShellMap aNewDocShells; + // To avoid potentially freezing Calc, we close one stale document at a time. DocShellMap::iterator itr = maDocShells.begin(), itrEnd = maDocShells.end(); for (; itr != itrEnd; ++itr) { // in 100th of a second. sal_Int32 nSinceLastAccess = (Time( Time::SYSTEM ) - itr->second.maLastAccess).GetTime(); - if (nSinceLastAccess < nTimeOut) - aNewDocShells.insert(*itr); - else - // Timed out. Let's close this. + if (nSinceLastAccess >= nTimeOut) + { + // Timed out. Let's close this, and exit the loop. itr->second.maShell->DoClose(); + maDocShells.erase(itr); + break; + } } - maDocShells.swap(aNewDocShells); if (maDocShells.empty()) maSrcDocTimer.Stop(); |