Max Bian wrote:

> Hello,
> 
> It seems that if the citation reference dialog opens a bibtex file to
> get the list of the keys, it keeps the bibtex file open.  If I try to
> edit the bibtex file at the same time using another program, I am not
> able to save it.  The error message is like "error 13, permission
> denied".
> 
> I do not have this problem under linux, only under cygwin.
> 
> Should the way lyx handles the bibtex file be changed?

Most certainly. However that won't solve your present problem.

Here is the relevant snippet of code. We read the file with an ifstream 
which should close the stream automatically when it goes out of scope. You 
could try adding an explicit 'ifs.close()' command to the code (to be found 
in src/insets/insetbib.C). 

See below, but I'm not promising anything:

 void InsetBibtex::fillWithBibKeys
        (Buffer const * buffer, vector<pair<string, string> > & keys) const
 {
        lyx::Assert(buffer);
        vector<string> const files = getFiles(*buffer);
        for (vector<string>::const_iterator it = files.begin();
             it != files.end(); ++ it) {
                // This is a _very_ simple parser for Bibtex database
                // files. All it does is to look for lines starting
                // in @ and not being @preamble and @string entries.
                // It does NOT do any syntax checking!
                ifstream ifs(it->c_str());
                string linebuf0;
                while (getline(ifs, linebuf0)) {
                        ...
                }
+               ifs.close();
        }
 }

-- 
Angus

Reply via email to