Guard QTimer::singleShot

This commit is contained in:
Klaus Basan
2018-05-06 20:24:40 +02:00
committed by Roland Winklmeier
parent 3ecb7b1f94
commit 3f4cb7529c
4 changed files with 33 additions and 8 deletions

View File

@@ -35,6 +35,7 @@
#include <QToolButton>
#include <Qt>
#include <QtGlobal>
#include <QPointer>
using namespace BlackMisc;
using namespace BlackMisc::Network;
@@ -453,7 +454,13 @@ namespace BlackGui
{
std::function<void()> f = m_pendingMessageCalls.front();
m_pendingMessageCalls.removeFirst();
QTimer::singleShot(500, this, f);
const QPointer<COverlayMessages> myself(this);
QTimer::singleShot(500, this, [ = ]
{
if (!myself) { return; }
if (!sGui || sGui->isShuttingDown()) { return; }
f();
});
}
}