Browse Source

Make sure ResumeSessionContext is destroyed before start processing

PR #18912.
adaptive-webui-19844
Vladimir Golovnev 2 years ago committed by GitHub
parent
commit
d83b2a6131
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 38
      src/base/bittorrent/sessionimpl.cpp

38
src/base/bittorrent/sessionimpl.cpp

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

Loading…
Cancel
Save