diff options
author | Tor Lillqvist <tml@collabora.com> | 2016-04-01 18:52:17 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2016-04-01 18:57:07 +0300 |
commit | 9a874e7cda195a155d14e84765d20b265391f48c (patch) | |
tree | b5ba5e077c1c5ee67dfb896879c3b75d4cad5467 | |
parent | Actually propagate idle/auto save requests to the kit processes (diff) | |
download | online-9a874e7cda195a155d14e84765d20b265391f48c.tar.gz online-9a874e7cda195a155d14e84765d20b265391f48c.zip |
Catch and ignore FileExceptions when persisting editing tiles
There is nothing that says a client has even requested any tiles, so
there might be none to persist. Don't let an exception thrown by the
DirectoryIterator propagate upwards and cause potential
issues.
Noticed the issue when testing using the 'connect' test program,
giving it input that did not request any tiles.
-rw-r--r-- | loolwsd/TileCache.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/loolwsd/TileCache.cpp b/loolwsd/TileCache.cpp index 988e9c2cd9..bf23cd999d 100644 --- a/loolwsd/TileCache.cpp +++ b/loolwsd/TileCache.cpp @@ -35,6 +35,7 @@ using Poco::DigestEngine; using Poco::DirectoryIterator; using Poco::File; +using Poco::FileException; using Poco::StringTokenizer; using Poco::SyntaxException; using Poco::Timestamp; @@ -192,9 +193,19 @@ void TileCache::documentSaved() _cacheMutex.lock(); // then move the new tiles from the Editing cache to Persistent - for (auto tileIterator = DirectoryIterator(_editCacheDir); tileIterator != DirectoryIterator(); ++tileIterator) + try { - tileIterator->moveTo(_persCacheDir); + for (auto tileIterator = DirectoryIterator(_editCacheDir); tileIterator != DirectoryIterator(); ++tileIterator) + { + tileIterator->moveTo(_persCacheDir); + } + } + catch (const FileException& exc) + { + // Just log this exception, ignore it otherwise + Log::error() << "TileCache::documentSaved: Exception: " << exc.displayText() + << (exc.nested() ? " (" + exc.nested()->displayText() + ")" : "") + << Log::end; } _cacheMutex.unlock(); |