[Libreoffice-commits] core.git: sc/source

Eike Rathke erack at redhat.com
Tue Jan 14 03:52:52 PST 2014


 sc/source/core/data/documen2.cxx         |    2 +-
 sc/source/ui/docshell/externalrefmgr.cxx |    7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 3b614521b6d3f6f238a73053c7cb40b42e19287b
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jan 14 12:40:30 2014 +0100

    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

diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 91352a1..45ea69b 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 81075a3..8c312ac 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);
 


More information about the Libreoffice-commits mailing list