Hi, I'm in a bit of a conundrum: using QSettings results in a crash under Windows XP, MinGW, Qt 4.7.
#include <QtCore/QCoreApplication>
#include <QtCore/QSettings>
int main(int argc, char *argv[])
{
s.setValue("test", "value");
return a.exec();
}
#include <QtCore/QCoreApplication>
#include <QtCore/QSettings>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope, "C:/folder");
QSettings s("Org", "App");
s.setValue("test", "value");
return a.exec();
}
To copy to clipboard, switch view to plain text mode
This simple app throws an exception at line 9, ultimately pointing to some code in qsettings.cpp:
if (SHGetSpecialFolderPath) {
wchar_t path[MAX_PATH];
SHGetSpecialFolderPath(0, path, type, FALSE);
result
= QString::fromWCharArray(path
);
}
if (SHGetSpecialFolderPath) {
wchar_t path[MAX_PATH];
SHGetSpecialFolderPath(0, path, type, FALSE);
result = QString::fromWCharArray(path);
}
To copy to clipboard, switch view to plain text mode
At other times, creating a pointer to a QSettings object in the header file and later initializing it results in the same exception:
// header of some class
...
// constructor of class
// header of some class
QSettings *mySettings;
...
// constructor of class
mySettings = new QSettings();
To copy to clipboard, switch view to plain text mode
This doesn't happen on Windows, and the app runs fine when I don't use a debugger. I found a reported bug on http://bugreports.qt.nokia.com/brows...s:all-tabpanel but it doesn't seem to be verified.
Bookmarks