DomTomCat
DomTomCat

Reputation: 8569

QFileDialog freezes on close/destructor (with selected file or cancel)

I'm developing applications in qt with Ubuntu 15.04 and the respective qt pakage 5.4. For some reason, out of nowhere the application would freeze after selecting a file within a QFileDialog (or even cancelling).

I found some similar topics on the web but most were concerned with a now resolved bug in qt 5.1 and (non-)native QFileDialogs.

Then I found out this is related to more than just my own application - even qtcreator would freeze on leaving the QFileDialog, now.

There seems to be a deadlock in the destructor of QFileDialog.

Upvotes: 1

Views: 698

Answers (1)

DomTomCat
DomTomCat

Reputation: 8569

The following snippet is from qsettings.cpp (line 1382), within void QConfFileSettingsPrivate::syncConfFile(int confFileNo)

QLockFile lockFile(confFile->name + QLatin1String(".lock"));
if (!readOnly) {
    if (!confFile->isWritable() || !lockFile.lock() ) {
        setStatus(QSettings::AccessError);
        return;
    }
}

It turns out some other qt application has left a lock file which causes all other applications' QFileDialog destructor to be deadlocked within the above lock call.

I searched for .lock files in my home folder and after deleting ./.config/QtProject.conf.lock and a second file similar to .config/USERNAME/APPTARGETNAME.conf.lock the QFileDialog works well, agian.

I just now can't reproduce which of the two files did cause the deadlock.

Hope this helps anyone in a similar situation!

Upvotes: 2

Related Questions