mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Build our Settings after our QApplication, fixes crash on startup
Thanks to @stqism for reporting the crash This is why global static variables are evil
This commit is contained in:
parent
57bcda7cd9
commit
7bca831066
|
@ -58,6 +58,8 @@ int main(int argc, char *argv[])
|
|||
a.setApplicationName("qTox");
|
||||
a.setOrganizationName("Tox");
|
||||
|
||||
Settings::getInstance(); // Build our Settings singleton as soon as QApplication is ready, not before
|
||||
|
||||
sodium_init(); // For the auto-updater
|
||||
|
||||
#ifdef LOG_TO_FILE
|
||||
|
|
|
@ -39,8 +39,10 @@ Settings::Settings() :
|
|||
|
||||
Settings& Settings::getInstance()
|
||||
{
|
||||
static Settings settings;
|
||||
return settings;
|
||||
static Settings* settings{nullptr};
|
||||
if (!settings)
|
||||
settings = new Settings();
|
||||
return *settings;
|
||||
}
|
||||
|
||||
void Settings::load()
|
||||
|
|
|
@ -296,7 +296,6 @@ Widget::~Widget()
|
|||
|
||||
Widget* Widget::getInstance()
|
||||
{
|
||||
|
||||
if (!instance)
|
||||
{
|
||||
instance = new Widget();
|
||||
|
|
Loading…
Reference in New Issue
Block a user