[Libreoffice-commits] core.git: Branch 'feature/cib_contract57c' - framework/source

Katarina Behrens (via logerrit) logerrit at kemper.freedesktop.org
Mon May 13 13:49:05 UTC 2019


 framework/source/loadenv/loadenv.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 367dfe659802bd46edad1b046a8651bfe26d87b0
Author:     Katarina Behrens <Katarina.Behrens at cib.de>
AuthorDate: Tue May 7 16:27:22 2019 +0200
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Mon May 13 15:07:31 2019 +0200

    tdf#83722: don't recycle frame with unmodified template
    
    a frame that contained valid but unmodified document opened from
    template or explicitly opened by the user (File > New) was treated
    the same as blank document i.e. it was reused and the content was
    overwritten by newly opened document (even if it already had
    non-empty content provided by the template).
    
    So let's not do that and let's open a new document in a new frame
    instead
    
    Change-Id: I10252d114e8cc5fcad3c98194ef07fd59873d6da
    Reviewed-on: https://gerrit.libreoffice.org/71919
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index b527d0259e77..4f9cfe71d567 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -1072,7 +1072,7 @@ bool LoadEnv::impl_loadContent()
     // if it will be run out of scope.
 
     // Note further: ignore if this internal guard already contains a resource.
-    // Might impl_searchRecylcTarget() set it before. But in case this impl-method wasn't used
+    // Might impl_searchRecycleTarget() set it before. But in case this impl-method wasn't used
     // and the target frame was new created ... this lock here must be set!
     css::uno::Reference< css::document::XActionLockable > xTargetLock(xTargetFrame, css::uno::UNO_QUERY);
     m_aTargetLock.setResource(xTargetLock);
@@ -1512,6 +1512,15 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchRecycleTarget()
     css::uno::Reference< css::frame::XController > xOldDoc = xTask->getController();
     if (xOldDoc.is())
     {
+        utl::MediaDescriptor lOldDocDescriptor(xModel->getArgs());
+        bool bFromTemplate = lOldDocDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_ASTEMPLATE() , false);
+        OUString sReferrer = lOldDocDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_REFERRER(), OUString());
+
+        // tdf#83722: valid but unmodified document, either from template
+        // or opened by the user (File > New)
+        if (bFromTemplate || !sReferrer.isEmpty())
+            return css::uno::Reference< css::frame::XFrame >();
+
         bReactivateOldControllerOnError = xOldDoc->suspend(true);
         if (! bReactivateOldControllerOnError)
             return css::uno::Reference< css::frame::XFrame >();


More information about the Libreoffice-commits mailing list