]> git.lyx.org Git - features.git/commitdiff
Fix a crash when closing tabs
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Feb 2021 14:35:42 +0000 (15:35 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Feb 2021 14:54:29 +0000 (15:54 +0100)
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

index 8414efa20439fbe50cc696f74dd1debc96caafcc..5c7b88682b1e0e041f841ea92af61ebbcf2b8b30 100644 (file)
@@ -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())