I was able to reproduce the problem with a single main.cpp (below). I reported to Trolltech, but feel free to try it out on your system. I am using Windows XP.
#include <QtGui>
#include <QDir>
///Change these as needed
#define SAMPLE_DIRECTORY_1 "c:\\"
#define SAMPLE_DIRECTORY_2 "c:\\jer"
#define NUM_REPEATS 100
///When DO_LOCK_MUTEX is turned off, inconsistencies are displayed on my system
//#define DO_LOCK_MUTEX
{
public:
void run()
{
QString dirname
=SAMPLE_DIRECTORY_1;
for (int j=0; j<NUM_REPEATS; j++) {
#ifdef DO_LOCK_MUTEX
my_mutex.lock();
#endif
if (str1!=str2) {
qDebug() << "~!!!!!!!!!!!!!!!!! Inconsistency with" << str1 << str2;
}
#ifdef DO_LOCK_MUTEX
my_mutex.unlock();
#endif
}
}
}
};
{
public:
void run()
{
QString dirname
=SAMPLE_DIRECTORY_2;
for (int j=0; j<NUM_REPEATS; j++) {
#ifdef DO_LOCK_MUTEX
my_mutex.lock();
#endif
if (str1!=str2) {
qDebug() << "~!!!!!!!!!!!!!!!!! Inconsistency with" << str1 << str2;
}
#ifdef DO_LOCK_MUTEX
my_mutex.unlock();
#endif
}
}
}
};
int main(int argc, char **argv)
{
wid.show();
MyThread1 T1;
MyThread2 T2;
T1.start();
T2.start();
qDebug() << "Looking for inconsistencies in QFileInfo::canonicalFilePath()";
return app.exec();
}
#include <QtGui>
#include <QDir>
///Change these as needed
#define SAMPLE_DIRECTORY_1 "c:\\"
#define SAMPLE_DIRECTORY_2 "c:\\jer"
#define NUM_REPEATS 100
///When DO_LOCK_MUTEX is turned off, inconsistencies are displayed on my system
//#define DO_LOCK_MUTEX
static QMutex my_mutex;
class MyThread1 : public QThread
{
public:
void run()
{
QString dirname=SAMPLE_DIRECTORY_1;
QDir dir(dirname);
QStringList list=dir.entryList(QStringList("*"));
for (int j=0; j<NUM_REPEATS; j++) {
foreach (QString F,list) {
#ifdef DO_LOCK_MUTEX
my_mutex.lock();
#endif
QString path=dirname+"/"+F;
QString str1=QFileInfo(path).canonicalFilePath();
QString str2=QFileInfo(path).canonicalFilePath();
if (str1!=str2) {
qDebug() << "~!!!!!!!!!!!!!!!!! Inconsistency with" << str1 << str2;
}
#ifdef DO_LOCK_MUTEX
my_mutex.unlock();
#endif
}
}
}
};
class MyThread2 : public QThread
{
public:
void run()
{
QString dirname=SAMPLE_DIRECTORY_2;
QDir dir(dirname);
QStringList list=dir.entryList(QStringList("*"));
for (int j=0; j<NUM_REPEATS; j++) {
foreach (QString F,list) {
#ifdef DO_LOCK_MUTEX
my_mutex.lock();
#endif
QString path=dirname+"/"+F;
QString str1=QFileInfo(path).canonicalFilePath();
QString str2=QFileInfo(path).canonicalFilePath();
if (str1!=str2) {
qDebug() << "~!!!!!!!!!!!!!!!!! Inconsistency with" << str1 << str2;
}
#ifdef DO_LOCK_MUTEX
my_mutex.unlock();
#endif
}
}
}
};
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QWidget wid;
wid.show();
MyThread1 T1;
MyThread2 T2;
T1.start();
T2.start();
qDebug() << "Looking for inconsistencies in QFileInfo::canonicalFilePath()";
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks