sd/source/ui/animations/SlideTransitionPane.cxx |    6 +++++-
 sd/source/ui/inc/SlideTransitionPane.hxx        |    2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 51ac1a796b2f4bfbd0fa03d053e2f21973960337
Author:     Rashesh Padia <[email protected]>
AuthorDate: Sun Sep 21 19:09:08 2025 +0530
Commit:     Miklos Vajna <[email protected]>
CommitDate: Fri Oct 3 08:48:33 2025 +0200

    tdf#167753: Fix infinite recursion in SlideTransitionPane focus handling
    
    Add recursion guard to applyToSelectedPages() to prevent infinite loop
    between VariantListBoxSelected and DurationLoseFocusHdl handlers.
    
    Problem:
    1. User selects variant -> VariantListBoxSelected ->
    applyToSelectedPages()
    2. Focus restoration via pFocusWindow->GrabFocus() at function end
    3. Duration field somehow loses focus -> DurationLoseFocusHdl triggered
    4. Calls applyToSelectedPages() again -> infinite recursion
    
    Focus restoration creates unguarded recursive pathway.
    The exact mechanism of why focus restoration causes duration field to
    lose focus is unknown.
    
    This patch fixes the problem by adding mbInApplyToPages guard to prevent
    re-entry into
    applyToSelectedPages() regardless of the underlying focus behavior.
    
    Change-Id: I3356f9f3c0a1bcff5ac04e961f2cca48785d8538
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191293
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Szymon Kłos <[email protected]>
    (cherry picked from commit 7424f63fc605aff917d9d65ddc8e0e22a13d99bd)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191312
    Tested-by: Jenkins

diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx 
b/sd/source/ui/animations/SlideTransitionPane.cxx
index dfff11e8de8c..0ffc7b19b290 100644
--- a/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -882,9 +882,11 @@ impl::TransitionEffect 
SlideTransitionPane::getTransitionEffectFromControls() co
 
 void SlideTransitionPane::applyToSelectedPages(bool bPreview = true)
 {
-    if(  mbUpdatingControls )
+    if (mbUpdatingControls || mbInApplyToPages)
         return;
 
+    mbInApplyToPages = true;
+
     vcl::Window *pFocusWindow = Application::GetFocusWindow();
 
     ::sd::slidesorter::SharedPageSelection pSelectedPages( getSelectedPages());
@@ -906,6 +908,8 @@ void SlideTransitionPane::applyToSelectedPages(bool 
bPreview = true)
 
     if (pFocusWindow)
         pFocusWindow->GrabFocus();
+
+    mbInApplyToPages = false;
 }
 
 void SlideTransitionPane::playCurrentEffect()
diff --git a/sd/source/ui/inc/SlideTransitionPane.hxx 
b/sd/source/ui/inc/SlideTransitionPane.hxx
index 974cab638504..484ff483634b 100644
--- a/sd/source/ui/inc/SlideTransitionPane.hxx
+++ b/sd/source/ui/inc/SlideTransitionPane.hxx
@@ -138,6 +138,8 @@ private:
     mutable OUString maCurrentSoundFile;
 
     Timer maLateInitTimer;
+
+    bool mbInApplyToPages = false;
 };
 
 } //  namespace sd

Reply via email to