sfx2/source/control/dispatch.cxx |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit 57a676cf951eaa65831b32b080cf3da013bf60fb
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Apr 26 10:52:54 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Wed Apr 26 11:12:28 2023 +0200

    Related: tdf#155017 Stop after the first pop in case the shell was not on 
stack
    
    After commit 271f17a6022c64cbbe9befbc66a9eaaa0567d569 (tdf#155017: make
    sure that the correct shell is popped from SfxDispatcher, 2023-04-26).
    
    This restores the previous logic for a hypothetical case of a pop without
    POP_UNTIL scheduled for a shell, which was not on the stack (so that it
    wasn't removed in the code added in the commit mentioned above); I haven't
    a reproducer, but it definitely can happen, given how things work here. So
    I try to avoid breaking it even further :-)
    
    Change-Id: Ied0a1406881fbefe3cf069f816c50da03a41dcd0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151034
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index e78789e56271..88377c073155 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -1346,6 +1346,13 @@ void SfxDispatcher::FlushImpl()
 
                 // Mark the moved Shell
                 aToDoCopy.push_front(SfxToDo_Impl(false, i->bDelete, false, 
*pPopped));
+                if (!i->bUntil)
+                {
+                    // We get here only when the requested shell was not on 
the stack.
+                    // I don't know how correct to pop a single random other 
shell and exit
+                    // in this case, but I just make sure that the previous 
logic is kept.
+                    break;
+                }
             }
             DBG_ASSERT( bFound, "wrong SfxShell popped" );
         }

Reply via email to