On 02/20/2016 07:21 PM, PhilipPirrip wrote:
> - 2 -
> download and unpack
> https://bitbucket.org/amiede/classicthesis/downloads/classicthesis-LyX-v4.2.zip
> (it might 'work' with simpler master/child documents, I don't have
> time to test it)
>
>
> start lyx2.2 from terminal
>
> start a new document (ctrl-n), type something in (this is to show
> there will be data loss)
>
> open ClassicThesis.lyx from e.g. classicthesis-LyX-v4.1_bugfix
>
> right-click on Include:Chapter02.lyx, choose "Edit Included File"
>
> change something in Chapter02 (add a character)
>
> go back to the master document (ClassicThesis.lyx)
>
> open Document Settings dialog, keep it open
>
> then File>Close (or ctrl-w)
>
> Save changes? - choose Discard
>
> LyX crashes, SIGSEGV
 
This one is more complicated, unfortunately. The cause of the problem is
similar to the other one, but I'm not at all sure what to do. The
difficulty is that, when we close the child, we then try to update the
Document>Settings dialog. This involves updating the "Include Only"
information, which requires getting the filenames from the child
Buffers. But the child Buffer has just been closed. Segfault.

I do not fully understand why this only happens when the child is dirty.
Presumably, it has something to do with our switching to the child in
saveBufferIfNeeded.

One solution would be to have Buffer::collectChildren make sure the
Buffers exist. Thus:

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 37dcbca..4a09a8a 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -3144,6 +3144,11 @@ void Buffer::collectChildren(ListOfBuffers &
clist, bool grand_children) const
        Impl::BufferPositionMap::iterator end = d->children_positions.end();
        for (; it != end; ++it) {
                Buffer * child = const_cast<Buffer *>(it->first);
+               // The only reason this should happen is because we have
closed
+               // the child Buffer, probably because we are about to
close this
+               // one.
+               if (!theBufferList().isLoaded(child))
+                       continue;
                // No duplicates
                ListOfBuffers::const_iterator bit = find(clist.begin(),
clist.end(), child);
                if (bit != clist.end())


Richard

Reply via email to