sc/source/ui/docshell/externalrefmgr.cxx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
New commits: commit 7e26ebc502dbef4f2bb75e1a4082cd1774b7e3bb Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Mon Jun 16 10:43:08 2014 -0400 Cache table entry may be null. Let's not assume it's always non-null. This is done intentionally because we do need correct table index when resolving external reference. This requires we do need to allocate array with the same sheet size as the remote document. But we don't allocate Table instances for remote sheets that we don't reference, to save memory. Change-Id: I27fb6228f0e4558327aa4a04a6bccce8d2f1085f (cherry picked from commit 3dcfb9a892e528a386bb304e4e00d2fa34b1de25) diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 7e9f6bd..1e41bd0 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -1130,15 +1130,18 @@ void ScExternalRefCache::getAllCachedDataSpans( sal_uInt16 nFileId, sc::ColumnSp const std::vector<TableTypeRef>& rTables = pDocItem->maTables; for (size_t nTab = 0, nTabCount = rTables.size(); nTab < nTabCount; ++nTab) { - const Table& rTable = *rTables[nTab]; + TableTypeRef pTab = rTables[nTab]; + if (!pTab) + continue; + std::vector<SCROW> aRows; - rTable.getAllRows(aRows); + pTab->getAllRows(aRows); std::vector<SCROW>::const_iterator itRow = aRows.begin(), itRowEnd = aRows.end(); for (; itRow != itRowEnd; ++itRow) { SCROW nRow = *itRow; std::vector<SCCOL> aCols; - rTable.getAllCols(nRow, aCols); + pTab->getAllCols(nRow, aCols); std::vector<SCCOL>::const_iterator itCol = aCols.begin(), itColEnd = aCols.end(); for (; itCol != itColEnd; ++itCol) { @@ -1254,8 +1257,11 @@ void ScExternalRefCache::clearCacheTables(sal_uInt16 nFileId) std::vector<TableTypeRef>& rTabs = pDocItem->maTables; for (size_t i = 0, n = rTabs.size(); i < n; ++i) { - Table& rTab = *rTabs[i]; - rTab.clear(); + TableTypeRef pTab = rTabs[i]; + if (!pTab) + continue; + + pTab->clear(); } // Clear the external range name caches. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits