summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-01-14 12:40:30 +0100
committerEike Rathke <erack@redhat.com>2014-01-14 12:52:27 +0100
commit3b614521b6d3f6f238a73053c7cb40b42e19287b (patch)
tree9197fd55f685ac52756c8282134be3146afc60e9
parent28c89909a456b9b6673d367f864661cb7f3b7179 (diff)
resolved fdo#73522 always create LinkManager if it doesn't exist yet
Regression introduced with 8fde2885236d5490be8f54e96dfe4a63d9bb9dec Crash happened under ScExternalRefManager::maybeLinkExternalFile() pLinkMgr->InsertFileLink(). ScDocument::GetLinkManager() introduced GetDocLinkManager().getLinkManager(bAutoCalc) leading to the LinkManager being created only if bAutoCalc is set, which may not be the case during file import. Changed to unconditionally create the LinkManager again so the link can actually be inserted. Whatever the intention was, that needs rework. Change-Id: I2ae66ac7f62c3cfd92c5bf1a147feb06b0155275
-rw-r--r--sc/source/core/data/documen2.cxx2
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx7
2 files changed, 7 insertions, 2 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 91352a10c741..45ea69b666aa 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -255,7 +255,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
sfx2::LinkManager* ScDocument::GetLinkManager()
{
- return GetDocLinkManager().getLinkManager(bAutoCalc);
+ return GetDocLinkManager().getLinkManager(true);
}
const sfx2::LinkManager* ScDocument::GetLinkManager() const
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 81075a34a92a..8c312ac97004 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2374,8 +2374,13 @@ void ScExternalRefManager::maybeLinkExternalFile(sal_uInt16 nFileId)
if (aFilter.isEmpty())
ScDocumentLoader::GetFilterName(*pFileName, aFilter, aOptions, true, false);
sfx2::LinkManager* pLinkMgr = mpDoc->GetLinkManager();
+ if (!pLinkMgr)
+ {
+ SAL_WARN( "sc.ui", "ScExternalRefManager::maybeLinkExternalFile: pLinkMgr==NULL");
+ return;
+ }
ScExternalRefLink* pLink = new ScExternalRefLink(mpDoc, nFileId, aFilter);
- OSL_ENSURE(pFileName, "ScExternalRefManager::insertExternalFileLink: file name pointer is NULL");
+ OSL_ENSURE(pFileName, "ScExternalRefManager::maybeLinkExternalFile: file name pointer is NULL");
OUString aTmp = aFilter;
pLinkMgr->InsertFileLink(*pLink, OBJECT_CLIENT_FILE, *pFileName, &aTmp);