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.setApplicationName("qTox");
|
||||||
a.setOrganizationName("Tox");
|
a.setOrganizationName("Tox");
|
||||||
|
|
||||||
|
Settings::getInstance(); // Build our Settings singleton as soon as QApplication is ready, not before
|
||||||
|
|
||||||
sodium_init(); // For the auto-updater
|
sodium_init(); // For the auto-updater
|
||||||
|
|
||||||
#ifdef LOG_TO_FILE
|
#ifdef LOG_TO_FILE
|
||||||
|
@ -39,8 +39,10 @@ Settings::Settings() :
|
|||||||
|
|
||||||
Settings& Settings::getInstance()
|
Settings& Settings::getInstance()
|
||||||
{
|
{
|
||||||
static Settings settings;
|
static Settings* settings{nullptr};
|
||||||
return settings;
|
if (!settings)
|
||||||
|
settings = new Settings();
|
||||||
|
return *settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::load()
|
void Settings::load()
|
||||||
|
@ -296,7 +296,6 @@ Widget::~Widget()
|
|||||||
|
|
||||||
Widget* Widget::getInstance()
|
Widget* Widget::getInstance()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!instance)
|
if (!instance)
|
||||||
{
|
{
|
||||||
instance = new Widget();
|
instance = new Widget();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user