commit bd104a2c950b19f5ba27d116611fea810e19ce83
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Wed Feb 12 09:45:36 2025 +0100

    Fix crash when attempting to load a corrupted master from a child (#13151)
    
    Never release a child of a buffer while this child is being loaded.
    Otherwise we will most likely crash upon a dangling pointer.
    
    (cherry picked from commit 27132aa63cd1a93b442e4daa1635a44935ab5635)
---
 src/Buffer.cpp | 5 ++++-
 status.24x     | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index fa4a45262b..f9adc51ec7 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -573,7 +573,10 @@ Buffer::~Buffer()
                        if (theBufferList().isLoaded(child)) {
                                if (theBufferList().isOthersChild(this, child))
                                        child->setParent(nullptr);
-                               else
+                               else if (child->isFullyLoaded())
+                                       // only release children if we are not 
currently
+                                       // loading them; otherwise we might get 
dangling
+                                       // pointers (#13151)
                                        theBufferList().release(child);
                        }
                }
diff --git a/status.24x b/status.24x
index 51982fde0c..24f4edeae7 100644
--- a/status.24x
+++ b/status.24x
@@ -58,6 +58,8 @@ What's new
 
 * DOCUMENT INPUT/OUTPUT
 
+- Fix crash when attempting to load a corrupted master from a child (bug 
13151).
+
 - Fix erroneous whitespace before and after math preview (bug 13127).
 
 - Ask to save unsaved changes before closing document dialog via ESC key or
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to