]> git.lyx.org Git - features.git/commitdiff
Fix crash reported on list when renaming a child buffer and
authorRichard Heck <rgheck@comcast.net>
Fri, 13 Jan 2012 03:31:01 +0000 (03:31 +0000)
committerRichard Heck <rgheck@comcast.net>
Fri, 13 Jan 2012 03:31:01 +0000 (03:31 +0000)
    then trying to compile.

    There are really two problems here. One is that the renamed
    buffer needs to be reloaded. All kinds of files, etc, may not
    exist any more, if we've been saved to a new directory; our
    children e.g. may not be in the right place. And, in this case,
    we may no longer be a child of our old parent. Reloading will
    fix all of that.

    On reload, though, we need to clear our parent, since we may
    not have one any more. It will get reset if need be.

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

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

index b5756c911639f35853b14fec98deef3107173372..766cbfe29193f512ed659c8169b360fa028753a1 100644 (file)
@@ -4523,6 +4523,8 @@ Buffer::ReadStatus Buffer::reload()
        d->filename.refresh();
        docstring const disp_fn = makeDisplayPath(d->filename.absFileName());
 
+       // clear parent. this will get reset if need be.
+       d->setParent(0);
        ReadStatus const status = loadLyXFile();
        if (status == ReadSuccess) {
                updateBuffer();
index 5ddfe193fd8012e4f29fbf6e6c8eced121bedf56..964c445ceda6a9d84ffa1b43cb8b21292e1620c4 100644 (file)
@@ -2316,7 +2316,10 @@ bool GuiView::renameBuffer(Buffer & b, docstring const & newname)
                }
        }
 
-       return saveBuffer(b, fname);
+       bool const saved = saveBuffer(b, fname);
+       if (saved)
+               b.reload();
+       return saved;
 }