]> git.lyx.org Git - features.git/commitdiff
If we are in a close_event all children will be closed in some time, so no need to...
authorVincent van Ravesteijn <vfr@lyx.org>
Tue, 18 Aug 2009 21:18:21 +0000 (21:18 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Tue, 18 Aug 2009 21:18:21 +0000 (21:18 +0000)
We don't want a master buffer to release all its children immediately because that would close dirty childs without saving and would make it impossible to store the childs in a proper way in the session file.

As, we close all children of a buffer together with the master itself, it is also no longer necessary to do it automatically.

I'll leave it commented out for a while in case someone objects to it.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31130 a592a061-630c-0410-9148-cb99ea01b6c8

src/Buffer.cpp
src/frontends/qt4/GuiView.cpp

index 60128969688d06eedf90a8c1a49a9ab93640c263..fe9cb181094f96bae0d77301479121afc50fe028 100644 (file)
@@ -318,7 +318,7 @@ Buffer::~Buffer()
                return;
        }
 
-       // loop over children
+       /*// loop over children
        Impl::BufferPositionMap::iterator it = d->children_positions.begin();
        Impl::BufferPositionMap::iterator end = d->children_positions.end();
        for (; it != end; ++it) {
@@ -326,7 +326,7 @@ Buffer::~Buffer()
                // The child buffer might have been closed already.
                if (theBufferList().isLoaded(child))
                        theBufferList().releaseChild(this, child);
-       }
+       }*/
 
        if (!isClean()) {
                docstring msg = _("Buffer had unsaved changes when destroyed!\n");
index ae5ae71b554633cf0074a430b911979788d77ce6..6821bbdd59acdac74d885c33be45b34826f7606c 100644 (file)
@@ -1923,17 +1923,24 @@ bool GuiView::closeWorkArea(GuiWorkArea * wa, bool close_buffer,
 {
        Buffer & buf = wa->bufferView().buffer();
 
+       // If we are in a close_event all children will be closed in some time,
+       // so no need to do it here. This will ensure that the children end up
+       // in the session file in the correct order. If we close the master
+       // buffer, we can close or release the child buffers here too.
        if (close_buffer && !closing_) {
                vector<Buffer *> clist = buf.getChildren();
                for (vector<Buffer *>::const_iterator it = clist.begin();
                         it != clist.end(); ++it) {
                        // If a child is dirty, do not close
                        // without user intervention
-                       //FIXME: should buffers be closed or not?
                        //FIXME: should we look in other tabworkareas?
-                       GuiWorkArea * child_wa = workArea(**it);
-                       if (child_wa && !closeWorkArea(child_wa, !close_buffer, false))
-                               return false;
+                       Buffer * child_buf = *it;
+                       GuiWorkArea * child_wa = workArea(*child_buf);
+                       if (child_wa) {
+                               if (!closeWorkArea(child_wa, true))
+                                       return false;
+                       } else
+                               theBufferList().releaseChild(&buf, child_buf);
                }
        }
        // goto bookmark to update bookmark pit.