fix crash bug with non-existing input files

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3360 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2002-01-13 21:35:50 +00:00
parent 836d40440f
commit 1d99b34719
4 changed files with 12 additions and 4 deletions

View File

@ -1,5 +1,8 @@
2002-01-13 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* bufferlist.C (readFile): create the buffer _after_ checking that
the file exists.
* lyxfunc.C (verboseDispatch): fix handling of arguments
* lyxrc.C (setDefaults): do not initialize document_path to $HOME.

View File

@ -357,8 +357,6 @@ void BufferList::emergencyWrite(Buffer * buf)
Buffer * BufferList::readFile(string const & s, bool ronly)
{
Buffer * b = bstore.newBuffer(s, ronly);
string ts(s);
string e = OnlyPath(s);
string a = e;
@ -371,6 +369,8 @@ Buffer * BufferList::readFile(string const & s, bool ronly)
return 0;
}
Buffer * b = bstore.newBuffer(s, ronly);
// Check if emergency save file exists and is newer.
e += OnlyFilename(s) + ".emergency";
FileInfo fileInfoE(e);

View File

@ -1,5 +1,8 @@
2002-01-13 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* insetinclude.C (loadIfNeeded): do not call bufferlist.readFile
if file does not exist
* figinset.C (browseFile): add shortcuts to directory buttons
* insettext.C (updateLocal): update menubar and toolbar here too.

View File

@ -218,8 +218,10 @@ bool InsetInclude::loadIfNeeded() const
// the readonly flag can/will be wrong, not anymore I think.
FileInfo finfo(getFileName());
bool const ro = !(!finfo.isOK() || finfo.writable());
return bufferlist.readFile(getFileName(), ro) != 0;
if (!finfo.isOK())
return false;
return bufferlist.readFile(getFileName(), !finfo.writable()) != 0;
}