diff options
| author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-05-23 15:14:56 +0200 |
|---|---|---|
| committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-06-13 20:20:33 +0200 |
| commit | 45c217646e3742070af15267df8fdb40c2a6c81a (patch) | |
| tree | 73b0b7de1f1e3822bd134ad023101347d0881479 /src/core/profile_adapter.cpp | |
| parent | f5207d2012efe408f178496b2023d822b33a6474 (diff) | |
Protect against default profile being deleted before its pages
Can really only happen in QML on exit.
Pick-to: 6.3 6.4
Task-number: QTBUG-99445
Change-Id: I1a04d57b6c4c40ae264b5519d2e41c57bca79a61
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src/core/profile_adapter.cpp')
| -rw-r--r-- | src/core/profile_adapter.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp index 7bcdaf4bc..81fe4dc0e 100644 --- a/src/core/profile_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -118,9 +118,8 @@ ProfileAdapter::~ProfileAdapter() { m_cancelableTaskTracker->TryCancelAll(); m_profile->NotifyWillBeDestroyed(); - while (!m_webContentsAdapterClients.isEmpty()) { - m_webContentsAdapterClients.first()->releaseProfile(); - } + releaseAllWebContentsAdapterClients(); + WebEngineContext::current()->removeProfileAdapter(this); if (m_downloadManagerDelegate) { m_profile->GetDownloadManager()->Shutdown(); @@ -673,6 +672,12 @@ void ProfileAdapter::removeWebContentsAdapterClient(WebContentsAdapterClient *cl m_webContentsAdapterClients.removeAll(client); } +void ProfileAdapter::releaseAllWebContentsAdapterClients() +{ + while (!m_webContentsAdapterClients.isEmpty()) + m_webContentsAdapterClients.first()->releaseProfile(); +} + void ProfileAdapter::resetVisitedLinksManager() { m_visitedLinksManager.reset(new VisitedLinksManagerQt(m_profile.data(), persistVisitedLinks())); |
