sfx2/source/view/viewfrm.cxx |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 7dd704ab1f41086f81136e3987fa7f9aed5ccf5f
Author: Mike Kaganski <mike.kagan...@collabora.com>
Date:   Sat Mar 10 20:14:37 2018 +0300

    tdf#116066: call DoSaveCompleted after SetReadOnlyUI
    
    Change-Id: Ided8f12764585b2ba62e4c296af43ac07b9e31ed
    Reviewed-on: https://gerrit.libreoffice.org/51051
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index c61076dfa0f1..a38e47f518a3 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -275,7 +275,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
             {
                 SfxViewFrame* m_pFrame;
                 SfxObjectShell* m_pSh;
+                SfxMedium* m_pMed = nullptr;
                 bool m_bSetRO;
+                ReadOnlyUIGuard(SfxViewFrame* pFrame, SfxObjectShell* p_Sh)
+                    : m_pFrame(pFrame), m_pSh(p_Sh), 
m_bSetRO(p_Sh->IsReadOnlyUI())
+                {}
                 ~ReadOnlyUIGuard() COVERITY_NOEXCEPT_FALSE
                 {
                     if (m_bSetRO != m_pSh->IsReadOnlyUI())
@@ -283,9 +287,15 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
                         m_pSh->SetReadOnlyUI(m_bSetRO);
                         if (!m_bSetRO)
                             m_pFrame->RemoveInfoBar("readonly");
+                        if (m_pMed)
+                        {
+                            // tdf#116066: DoSaveCompleted should be called 
after SetReadOnlyUI
+                            m_pSh->DoSaveCompleted(m_pMed);
+                            m_pSh->Broadcast(SfxHint(SfxHintId::ModeChanged));
+                        }
                     }
                 }
-            } aReadOnlyUIGuard{ this, pSh, pSh->IsReadOnlyUI() };
+            } aReadOnlyUIGuard(this, pSh);
 
             SfxMedium* pMed = pSh->GetMedium();
 
@@ -522,8 +532,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
                 }
                 else
                 {
-                    pSh->DoSaveCompleted( pMed );
-                    pSh->Broadcast( SfxHint(SfxHintId::ModeChanged) );
+                    aReadOnlyUIGuard.m_pMed = pMed;
                     rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), true ) );
                     rReq.Done( true );
                     return;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to