]> 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@lyx.org>
Sat, 21 Jul 2012 14:06:44 +0000 (10:06 -0400)
    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
(cherry picked from commit 9283cbdbcb3b33da28d2ecca6cd5665f39c7b388)

src/Buffer.cpp
src/frontends/qt4/GuiView.cpp
status.20x

index 97ed9d81fd61dd277386e37b6d09659dab3cab1b..c246190c09f5a9fb280a1536122aa9fd2d961495 100644 (file)
@@ -4427,6 +4427,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 3adc781b49c2c982bfbc4e553b178203c0a78118..f339119dde6805fd119f20225def67e09de86f20 100644 (file)
@@ -2292,7 +2292,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;
 }
 
 
index d4414dcd021d2a3d93d3c469c3cc5378dd5c3334..158370e8dde56a960f581e528f8f29864e684574 100644 (file)
@@ -97,6 +97,8 @@ What's new
 
 - Fix crash when using undo in a paragraph with layout Bibliography (bug 7111).
 
+- Fix crash when renaming a child buffer.
+
 - Replace current selection when pasting (bug 8027).
 
 - Make sure that undo restores environment depth correctly (bug 8159).
@@ -108,7 +110,8 @@ What's new
 - Fix problem with configure.py when the user profile path on Windows
   contains non-ascii characters (bug 8254).
 
-- remove annoying startup debug message.
+- Remove annoying startup debug message.
+
 
 * DOCUMENTATION AND LOCALIZATION