nickolais
12th February 2009, 02:40
Hello,
I am using Qt4 libraries in V3.5.4 KDevelop and I am having a general debugging issue.
I have a QFile instance in a subclassed QThread, and have noticed that whenever I try to debug step over a QFile method, the debugger completely freezes. I have tried stepping over said function calls and even stepping into said function calls, and the debugger freezes.
Below is how I am using my code.
class MyQThread : public QThread
{
...
private:
QFile * file;
};
MyQThread::MyQThread(QObject * parent) : QThread(parent)
{
file = NULL;
}
void MyQThread::run()
{
bool doneReading;
while (running) {
/* get file if null */
if (!file) {
QString path = getPathToFile();
file = new QFile(path);
if (!file->open(QIODevice::ReadOnly)) { /* !! FREEZES HERE !! */
delete file; /* never enters here */
file = NULL;
return;
}
}
/* never gets to here */
doneReading = readSomeFileData(file);
if (doneReading) {
file->close();
delete file;
file = NULL;
}
}
}
I am pretty sure there are no open file desciptors on the files I am attempting to open b/c I have tested this code after rebooting the machine and manipulating the files in no way. Also, I have verified that I am getting the correct path.
Are there any funny quirks about using QFile in a QThread and not the main GUI thread?
Thanks in advance.
I am using Qt4 libraries in V3.5.4 KDevelop and I am having a general debugging issue.
I have a QFile instance in a subclassed QThread, and have noticed that whenever I try to debug step over a QFile method, the debugger completely freezes. I have tried stepping over said function calls and even stepping into said function calls, and the debugger freezes.
Below is how I am using my code.
class MyQThread : public QThread
{
...
private:
QFile * file;
};
MyQThread::MyQThread(QObject * parent) : QThread(parent)
{
file = NULL;
}
void MyQThread::run()
{
bool doneReading;
while (running) {
/* get file if null */
if (!file) {
QString path = getPathToFile();
file = new QFile(path);
if (!file->open(QIODevice::ReadOnly)) { /* !! FREEZES HERE !! */
delete file; /* never enters here */
file = NULL;
return;
}
}
/* never gets to here */
doneReading = readSomeFileData(file);
if (doneReading) {
file->close();
delete file;
file = NULL;
}
}
}
I am pretty sure there are no open file desciptors on the files I am attempting to open b/c I have tested this code after rebooting the machine and manipulating the files in no way. Also, I have verified that I am getting the correct path.
Are there any funny quirks about using QFile in a QThread and not the main GUI thread?
Thanks in advance.