From 83dc36d66c50e9b47123a55eff101324fb20110e Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Mon, 9 Mar 2009 23:30:08 +0000 Subject: [PATCH] Fix an infinite loop with Qt4.5 when creating two unnamed files. In Qt4.5, QFileInfo::operator==() compares the file locations instead of the files themselves. Therefore, an extra check is needed. see Qt4.5 documentation: http://doc.trolltech.com/4.5/qfileinfo.html git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28748 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/FileName.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp index 3bedc0475a..1beeb29194 100644 --- a/src/support/FileName.cpp +++ b/src/support/FileName.cpp @@ -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(); } -- 2.39.2