Fix an infinite loop with Qt4.5 when creating two unnamed files.

In Qt4.5, QFileInfo::operator==() always returns true when comparing two non-existing files. Therefore, an extra check is needed. 

see 
http://www.lyx.org/trac/changeset/28748


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@28768 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-03-14 10:47:29 +00:00
parent 7238dc91e8
commit 9ad1428486
3 changed files with 11 additions and 2 deletions

View File

@ -269,6 +269,8 @@ What's new in version 1.6.2?
- Fix the use of regular expressions to avoid crashes with Qt4.5.
- Fix an infinite loop when creating multiple unnamed files with Qt4.5.
- Ignore the master_buffer setting in Document>Settings if the current
document is no real child. This fixes a crash when using the outliner
in such files (bug 5653).

View File

@ -944,7 +944,10 @@ bool operator==(FileName const & l, FileName const & r)
if (!lhs.d->fi.isSymLink() && !rhs.d->fi.isSymLink()) {
// Qt already checks if the filesystem is case sensitive or not.
return lhs.d->fi == rhs.d->fi;
return lhs.d->fi == rhs.d->fi
// This is needed as in Qt4.5, QFileInfo::operator== compares
// the location of the two files and not the files themselves.
&& lhs.d->fi.fileName() == rhs.d->fi.fileName();
}
// FIXME: When/if QFileInfo support symlink comparison, remove this code.
@ -954,7 +957,9 @@ bool operator==(FileName const & l, FileName const & r)
QFileInfo fi2(rhs.d->fi);
if (fi2.isSymLink())
fi2 = QFileInfo(fi2.symLinkTarget());
return fi1 == fi2;
// This is needed as in Qt4.5, QFileInfo::operator== compares
// the location of the two files and not the files themselves.
return fi1 == fi2 && fi1.fileName() == fi2.fileName();
}

View File

@ -213,6 +213,8 @@ What's new
- Fix the use of regular expressions to avoid crashes with Qt4.5.
- Fix an infinite loop when creating multiple unnamed files with Qt4.5.
- Ignore the master_buffer setting in Document>Settings if the current
document is no real child. This fixes a crash when using the outliner
in such files (bug 5653).