commit dcb84bfbf759a40c82295737f38dade1a1141970
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Sun Jan 4 21:48:13 2026 +0100

    Fixup 999fb37e: do not short-circuit updateMacros in the middle of an 
action.
    
    This can cause crashes, for example when updateCommand has been run
    and no new recordUndo happens in a complex operation. Many cases can
    happen, and we try to catch all of them by looking whether an undo
    group has been open.
    
    Note that this condition is also used in BufferView::busy().
    
    (cherry picked from commit 9eb6b26b48deb3ad40948ff68d87e6e8c3740931)
---
 src/Buffer.cpp | 9 +++++++--
 status.24x     | 2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 46db015569..73de572eb0 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -3950,8 +3950,13 @@ void Buffer::updateMacros() const
        if (d->macro_lock)
                return;
 
-       // early exit if the buffer has not changed since last time
-       if (d->gui_ && d->update_macros_id_ == d->id_)
+       /** Optimization: early exit if the 3 following conditions hold.
+        * 1/ gui is used (otherwise some crashes can happen),
+        * 2/ we are not in the middle of a complex operation (ex: repaint
+        *    happens in the midle of a Paste because of a dialog),
+        * 3/ the buffer has not changed since last time.
+        */
+       if (d->gui_ && !undo().activeUndoGroup() && d->update_macros_id_ == 
d->id_)
                return;
        d->update_macros_id_ = d->id_;
 
diff --git a/status.24x b/status.24x
index 43bb58c0a1..d1f82d6525 100644
--- a/status.24x
+++ b/status.24x
@@ -75,6 +75,8 @@ What's new
 
 - Fix space problem after inline listings (bug 13244).
 
+- Fix macro-related crash after some operations that trigger a dialog.
+
 
 * USER INTERFACE
 
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to