Solved Using QSettings on Mac crashes on launch. Is there a fix?
-
You don't need a global QSettings. Just create one when you need to either read or write a setting and be done with it.
-
@SGaist Thanks. I assume this means that the bug report was not related to my problem? Thanks for your help!
-
The bug report was about a corrupted file which doesn't match your use case.
All in all, since you have already built Qt with the patch applied, did you also test it for your use case ?
-
@SGaist Qt with the patch applied is still building ;( I tested the above with the original build I was using when I got the error and the program loaded with no problems. Thanks again for your help :)
-
Still building ? What machine do you have ? What options did you pass to configure ?
-
@SGaist A 2011 Mac book pro. The reason it's still building because it failed about an hour in while I was out. So I'm building it again :)
-
If you only need the core modules for your application, just build qtbase, that will save you lots of times
-
@SGaist Thanks - not sure if i did that or not, lol, but I'll do it next time as I'm only using the core modules :)
-
@Crossy said:
QSettings settings;
void GlobalSettings::saveSetting(int day) // This function is defined statically in globalsettings.h.
{
settings.setValue("dayNumber", day);
}SGaist is right, the code should look like this:
void GlobalSettings::saveSetting(int day) // This function is defined statically in globalsettings.h.
{
QSettings settings; // <-- NOT a global
settings.setValue("dayNumber", day);
}This is much better than your current implementation, since the destructor of QSettings will save/sync the preferences right away.
And if the global is really what is causing the problem, that would fix it. -
@sandy.martel23 Thanks for your help :) It was the global causing the problem - after changing it to how you and SGaist suggested, it has worked :) Thank you!
-
Good !
Since everything is working now, please mark the thread as solved using the "Topic Tool" button so that other forum users may know a solution has been found :)