mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix #599
This commit is contained in:
parent
b68134aaa7
commit
77edbb668e
|
@ -1355,7 +1355,7 @@ void Core::switchConfiguration(const QString& profile)
|
|||
clearPassword(ptHistory);
|
||||
toxTimer->stop();
|
||||
|
||||
Widget::getInstance()->setEnabled(false);
|
||||
Widget::getInstance()->setEnabledThreadsafe(false);
|
||||
if (tox) {
|
||||
toxav_kill(toxav);
|
||||
toxav = nullptr;
|
||||
|
@ -1373,7 +1373,7 @@ void Core::switchConfiguration(const QString& profile)
|
|||
HistoryKeeper::getInstance()->resetInstance();
|
||||
|
||||
start();
|
||||
Widget::getInstance()->setEnabled(true);
|
||||
Widget::getInstance()->setEnabledThreadsafe(true);
|
||||
}
|
||||
|
||||
void Core::loadFriends()
|
||||
|
|
|
@ -1072,3 +1072,18 @@ QMessageBox::StandardButton Widget::showWarningMsgBox(const QString& title, cons
|
|||
return QMessageBox::warning(this, title, msg, buttons);
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::setEnabledThreadsafe(bool enabled)
|
||||
{
|
||||
// We can only do this from the GUI thread
|
||||
if (QThread::currentThread() != qApp->thread())
|
||||
{
|
||||
QMetaObject::invokeMethod(this, "setEnabledThreadsafe", Qt::BlockingQueuedConnection,
|
||||
Q_ARG(bool, enabled));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ public:
|
|||
void setTranslation();
|
||||
Q_INVOKABLE QMessageBox::StandardButton showWarningMsgBox(const QString& title, const QString& msg,
|
||||
QMessageBox::StandardButtons buttonss = QMessageBox::Ok);
|
||||
Q_INVOKABLE void setEnabledThreadsafe(bool enabled);
|
||||
~Widget();
|
||||
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
|
|
Loading…
Reference in New Issue
Block a user