Browse Source

fix(logout): Synchronously call showLogin to avoid multiple deletion

Fixes #4201
reviewable/pr4677/r1
anthony.bilinski 8 years ago
parent
commit
5046fc9010
  1. 4
      src/model/profile/profileinfo.cpp
  2. 9
      src/nexus.cpp
  3. 1
      src/nexus.h

4
src/model/profile/profileinfo.cpp

@ -217,7 +217,7 @@ IProfileInfo::SaveResult ProfileInfo::exportProfile(const QString &path) const @@ -217,7 +217,7 @@ IProfileInfo::SaveResult ProfileInfo::exportProfile(const QString &path) const
QVector<QString> ProfileInfo::removeProfile()
{
QVector<QString> manualDeleteFiles = profile->remove();
Nexus::getInstance().showLoginLater();
QMetaObject::invokeMethod(&Nexus::getInstance(), "showLogin", Qt::BlockingQueuedConnection);
return manualDeleteFiles;
}
@ -227,7 +227,7 @@ QVector<QString> ProfileInfo::removeProfile() @@ -227,7 +227,7 @@ QVector<QString> ProfileInfo::removeProfile()
void ProfileInfo::logout()
{
Settings::getInstance().saveGlobal();
Nexus::getInstance().showLoginLater();
QMetaObject::invokeMethod(&Nexus::getInstance(), "showLogin", Qt::BlockingQueuedConnection);
}
/**

9
src/nexus.cpp

@ -338,15 +338,6 @@ bool Nexus::tryRemoveFile(const QString& filepath) @@ -338,15 +338,6 @@ bool Nexus::tryRemoveFile(const QString& filepath)
return writable;
}
/**
* @brief Calls showLogin asynchronously, so we can safely logout from within the main GUI
*/
void Nexus::showLoginLater()
{
GUI::setEnabled(false);
QMetaObject::invokeMethod(&getInstance(), "showLogin", Qt::QueuedConnection);
}
void Nexus::onLastWindowClosed()
{
if (quitOnLastWindowClosed)

1
src/nexus.h

@ -57,7 +57,6 @@ public: @@ -57,7 +57,6 @@ public:
public slots:
void showLogin();
void showLoginLater();
#ifdef Q_OS_MAC
public:

Loading…
Cancel
Save