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

Lionel Elie Mamane lionel at mamane.lu
Sun Oct 18 11:58:22 PDT 2015


 svx/source/form/fmshell.cxx |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit ddc2de207a55b56a9f706ce3ddfc8ddb48bdf2e8
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sun Oct 18 20:54:49 2015 +0200

    reorganise code, no behaviour change intended
    
    ... at leat in normal circumstances.
    assumed that the dialog can only return Yes/No/Cancel
    if it doesn't, then behaviour change, be more conservative and save only on yes.
    
    the order between rController->commitCurrentRecord( ) and
    GetImpl()->didPrepareClose( true ) is changed, that's on purpose.
    If commitCurrentRecord( ) throws, then don't do GetImpl()->didPrepareClose( true )
    
    Change-Id: Ieb88c04a27e71b313e7f1386d48f370a1e94c6c2

diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx
index 31d9e55..99bcb04 100644
--- a/svx/source/form/fmshell.cxx
+++ b/svx/source/form/fmshell.cxx
@@ -265,7 +265,7 @@ bool FmFormShell::PrepareClose(bool bUI)
                 const svx::ControllerFeatures& rController = GetImpl()->getActiveControllerFeatures();
                 if ( rController->commitCurrentControl() )
                 {
-                    bool bModified = rController->isModifiedRow();
+                    const bool bModified = rController->isModifiedRow();
 
                     if ( bModified && bUI )
                     {
@@ -274,19 +274,16 @@ bool FmFormShell::PrepareClose(bool bUI)
                             "svx/ui/savemodifieddialog.ui");
                         switch (aQry->Execute())
                         {
-                            case RET_NO:
-                                bModified = false;
-                                // fallthrough to next case
                             case RET_YES:
+                                bResult = rController->commitCurrentRecord( );
+                                // fallthrough to next case
+                            case RET_NO:
                                 GetImpl()->didPrepareClose( true );
                                 break;
 
                             case RET_CANCEL:
                                 return false;
                         }
-
-                        if ( bModified )
-                            bResult = rController->commitCurrentRecord( );
                     }
                 }
             }


More information about the Libreoffice-commits mailing list