[LyX/master] Fix a crash when closing tabs

Jean-Marc Lasgouttes lasgouttes at lyx.org
Thu Feb 18 14:50:43 UTC 2021


commit 65b674ba4eff34df1ef7a7cf0f9e6a2585294c00
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Thu Feb 18 15:35:42 2021 +0100

    Fix a crash when closing tabs
    
    Although I do not know how to reproduce the crash, the change makes sense.
    
    This is backported from gadmm's lyx-unstable tree
    https://gitlab.com/gadmm/lyx-unstable/-/commit/261ce4ea98d82625a07f0fcf85e40f9055d2db3b
---
 src/Buffer.cpp |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 8414efa..5c7b886 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -3538,6 +3538,9 @@ void Buffer::collectChildren(ListOfBuffers & children, bool grand_children) cons
 	// loop over children
 	for (auto const & p : d->children_positions) {
 		Buffer * child = const_cast<Buffer *>(p.first);
+		// This can happen when called during GUI operations
+		if (!theBufferList().isLoaded(child))
+			continue;
 		// No duplicates
 		ListOfBuffers::const_iterator bit = find(children.begin(), children.end(), child);
 		if (bit != children.end())


More information about the lyx-cvs mailing list