editeng/source/editeng/impedit2.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit f6c809b021312dbda2964aa98beebb872bdbd81a
Author:     Noel Grandin <[email protected]>
AuthorDate: Fri Oct 3 11:09:59 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Oct 3 12:30:02 2025 +0200

    tdf#168674 Assertion fires when editing a formula in formula bar in debug
    
    on Windows, this assert fires because we have a stack like:
    
            editenglo.dll!ImpEditEngine::PaMtoEditCursor
            editenglo.dll!ImpEditEngine::Command
        ....
            sclo.dll!ScTabView::ActiveGrabFocus
            sclo.dll!ScInputHandler::EnterHandler2
    
    where EnterHandler2 is disabling layout, but during the focus grab,
    on Windows, some  SalInputContext code is triggered, which then
    needs the layout.
    
    Change-Id: I14b213af57a8e78f3983f0fd96110888906b43d1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191814
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index cab3236120f0..5a617b0e6146 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -487,7 +487,10 @@ bool ImpEditEngine::Command( const CommandEvent& rCEvt, 
EditView* pView )
     }
     else if ( rCEvt.GetCommand() == CommandEventId::CursorPos )
     {
-        EditPaM aPaM( pView->getImpl().GetEditSelection().Max() );
+        // tdf#168674 we are possibly being called from the calc formula bar 
in ScInputHandler::EnterHandler2, where layout is off
+        const bool bOldUpdateLayout = SetUpdateLayout(true);
+
+        EditPaM aPaM(pView->getImpl().GetEditSelection().Max());
         tools::Rectangle aR1 = PaMtoEditCursor( aPaM );
 
         if ( !IsFormatted() )
@@ -515,6 +518,7 @@ bool ImpEditEngine::Command( const CommandEvent& rCEvt, 
EditView* pView )
             else if (vcl::Window* pWindow = pView->GetWindow())
                 pWindow->SetCursorRect(&aRect, nExtTextInputWidth);
         }
+        SetUpdateLayout(bOldUpdateLayout);
     }
     else if ( rCEvt.GetCommand() == CommandEventId::SelectionChange )
     {

Reply via email to