From d2e8a5b8eb6c985715d228db072a66dc0460b095 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Tue, 13 Dec 2011 19:18:09 +0000 Subject: [PATCH] Fix issue noted by Julien: With new files especially, we will find the name we are trying to write in the BufferList, since the file gets a name when it is created. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40489 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiView.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index b84c6f310e..1b3df11a79 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -2282,8 +2282,9 @@ bool GuiView::renameBuffer(Buffer & b, docstring const & newname) // fname is now the new Buffer location. // if there is already a Buffer open with this name, we do not want - // to have another one. - if (theBufferList().exists(fname)) { + // to have another one. (the second test makes sure we're not just + // trying to overwrite ourselves, which is fine.) + if (theBufferList().exists(fname) && fname != oldname) { docstring const text = bformat(_("The file\n%1$s\nis already open in your current session.\n" "Please close it before attempting to overwrite it.\n" -- 2.39.2