mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix more save corruption bugs
askProfiles is a really dangerous function. Awful things happen when the user closes that message box. We now prevent it from being closed in more places
This commit is contained in:
parent
7eb9370c0b
commit
d962148dd0
|
@ -863,10 +863,11 @@ QByteArray Core::loadToxSave(QString path)
|
||||||
GUI::showWarning(tr("Profile already in use"),
|
GUI::showWarning(tr("Profile already in use"),
|
||||||
tr("Your profile is already used by another qTox\n"
|
tr("Your profile is already used by another qTox\n"
|
||||||
"Please select another profile"));
|
"Please select another profile"));
|
||||||
path = Settings::getInstance().askProfiles();
|
QString tmppath = Settings::getInstance().askProfiles();
|
||||||
if (path.isEmpty())
|
if (tmppath.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
Settings::getInstance().switchProfile(QFileInfo(path).baseName());
|
Settings::getInstance().switchProfile(tmppath);
|
||||||
|
path = QDir(Settings::getSettingsDirPath()).filePath(tmppath + TOX_EXT);
|
||||||
HistoryKeeper::resetInstance();
|
HistoryKeeper::resetInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -875,7 +876,7 @@ QByteArray Core::loadToxSave(QString path)
|
||||||
|
|
||||||
if (!configurationFile.exists())
|
if (!configurationFile.exists())
|
||||||
{
|
{
|
||||||
qWarning() << "The Tox configuration file was not found";
|
qWarning() << "The Tox configuration file "<<path<<" was not found";
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -960,7 +961,9 @@ void Core::switchConfiguration(const QString& _profile)
|
||||||
GUI::showWarning(tr("Profile already in use"),
|
GUI::showWarning(tr("Profile already in use"),
|
||||||
tr("Your profile is already used by another qTox instance\n"
|
tr("Your profile is already used by another qTox instance\n"
|
||||||
"Please select another profile"));
|
"Please select another profile"));
|
||||||
profile = QFileInfo(Settings::getInstance().askProfiles()).baseName();
|
do {
|
||||||
|
profile = Settings::getInstance().askProfiles();
|
||||||
|
} while (profile.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile.isEmpty())
|
if (profile.isEmpty())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user