On Windows, CamiTK applications may block or wait indefinitely
About you
CamiTK developer, reported by two windows users
Overview
After a crash, and even after reinstalling CamiTK, camitk-imp does not open or takes a very long time (several minutes) before opening. camitk-config can display paths, but will not return for a very long time, or display a locking timeout in a command window.
Steps to Reproduce
Not obvious. It seems to involve .lock or .rmlock files in %username%/AppData/Roaming/CamiTK directory. Removing the entire directory seems to fix it.
Actual VS Expected Result
Expected: camitk-imp starts in a few seconds (not minutes), and camitk-config returns less than a second after displaying the info (not minutes).
Relevant logs and/or screenshots
A Qt message is sometimes displayed in a loop in a terminal while camitk-config is waiting to exit (data already displayed, but the software is not exiting): "Got unexpected locking error 123"
Interpretation & Possible fixes
Not obvious. It seems that in some circumstances, in the %username%/AppData/Roaming/CamiTK directory, some lock files are present and Qt tries to lock settings files but fails to do so. It might also come from a conflict between camitk-config and camitk-imp trying to access the file at the same time.
This stems from the Application class creating a QSettings object in Application.cpp (global static object):
QSettings Application::settings(QSettings::IniFormat, QSettings::UserScope, "CamiTK", QString(Core::version).remove(QChar(' ')));
From Qt documentation IniFormat should work and manage locking correctly, but it seems that sometimes it fails to do so.
Turning the locking safety off might solve this problem as stated in the documentation but it might create other issues (if multiple camitk applications are running and overwrite each other's settings).
CamiTK Version
Stable 5.0 windows version
please do not remove anything below this line