Tidying up around QPointer guards.

This commit is contained in:
Mat Sutcliffe
2019-04-29 19:47:05 +01:00
committed by Klaus Basan
parent 3d935485dd
commit 61d933be12
3 changed files with 6 additions and 11 deletions

View File

@@ -475,7 +475,7 @@ namespace BlackCore
if (ms > 10) if (ms > 10)
{ {
// As of https://dev.swift-project.org/T558 play additional notification // As of https://dev.swift-project.org/T558 play additional notification
const QPointer<CContextAudio> myself(const_cast<CContextAudio *>(this)); //! \fixme KB 2019-03 add bit hacky as I need non-const and do not want to change all signatures const QPointer<const CContextAudio> myself(this);
QTimer::singleShot(ms, this, [ = ] QTimer::singleShot(ms, this, [ = ]
{ {
if (!sApp || sApp->isShuttingDown() || !myself) { return; } if (!sApp || sApp->isShuttingDown() || !myself) { return; }

View File

@@ -84,7 +84,6 @@ namespace BlackGui
const CGlobalSetup setup = sApp->getGlobalSetup(); const CGlobalSetup setup = sApp->getGlobalSetup();
if (setup.wasLoadedFromWeb()) if (setup.wasLoadedFromWeb())
{ {
QPointer<CSetupLoadingDialog> myself(this);
QTimer::singleShot(250, this, [ = ] QTimer::singleShot(250, this, [ = ]
{ {
const CUrlList bootstrapUrls = setup.getSwiftBootstrapFileUrls(); const CUrlList bootstrapUrls = setup.getSwiftBootstrapFileUrls();

View File

@@ -200,16 +200,12 @@ namespace BlackMisc
if (!CThreadUtils::isCurrentThreadObjectThread(this)) if (!CThreadUtils::isCurrentThreadObjectThread(this))
{ {
// shift in correct thread // shift in correct thread
if (!this->isFinished()) QPointer<CContinuousWorker> myself(this);
QTimer::singleShot(0, this, [ = ]
{ {
QPointer<CContinuousWorker> myself(this); if (!myself) { return; }
QTimer::singleShot(0, this, [ = ] this->doIfNotFinished([ = ] { startUpdating(updateTimeSecs); });
{ });
if (!myself) { return; }
if (this->isFinished()) { return; }
this->startUpdating(updateTimeSecs);
});
}
return; return;
} }