diff --git a/src/base/bittorrent/sessionimpl.cpp b/src/base/bittorrent/sessionimpl.cpp index 987391a73..40557e227 100644 --- a/src/base/bittorrent/sessionimpl.cpp +++ b/src/base/bittorrent/sessionimpl.cpp @@ -1435,27 +1435,29 @@ void SessionImpl::endStartup(ResumeSessionContext *context) } context->deleteLater(); + connect(context, &QObject::destroyed, this, [this] + { + m_nativeSession->resume(); + if (m_refreshEnqueued) + m_refreshEnqueued = false; + else + enqueueRefresh(); - m_nativeSession->resume(); - if (m_refreshEnqueued) - m_refreshEnqueued = false; - else - enqueueRefresh(); - - m_statisticsLastUpdateTimer.start(); + m_statisticsLastUpdateTimer.start(); - // Regular saving of fastresume data - connect(m_resumeDataTimer, &QTimer::timeout, this, &SessionImpl::generateResumeData); - const int saveInterval = saveResumeDataInterval(); - if (saveInterval > 0) - { - m_resumeDataTimer->setInterval(std::chrono::minutes(saveInterval)); - m_resumeDataTimer->start(); - } + // Regular saving of fastresume data + connect(m_resumeDataTimer, &QTimer::timeout, this, &SessionImpl::generateResumeData); + const int saveInterval = saveResumeDataInterval(); + if (saveInterval > 0) + { + m_resumeDataTimer->setInterval(std::chrono::minutes(saveInterval)); + m_resumeDataTimer->start(); + } - m_isRestored = true; - emit startupProgressUpdated(100); - emit restored(); + m_isRestored = true; + emit startupProgressUpdated(100); + emit restored(); + }); } void SessionImpl::initializeNativeSession()