summaryrefslogtreecommitdiffstats
path: root/src/core/profile_adapter.cpp
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2019-02-28 10:49:22 +0100
committerMichal Klocek <michal.klocek@qt.io>2019-03-01 15:59:37 +0000
commit56fadb571f32b721d8b99554e6e38692009ec37f (patch)
tree0d57ee708bca414342c69dbf924a016f09361169 /src/core/profile_adapter.cpp
parentddfa2997939fc4de2993b3e0de2201eca534af61 (diff)
Force destruction of webcontent client before profile adapter
Currently users might forget to delete webcontent client before profile adapter. This might be nasty if users are not aware of default profile. Instead of asserting badly in chromium, clean up and release chromium resources. This avoids the crash, but might leak memory if users never deletes page. Task-number: QTBUG-74021 Change-Id: I66f466f169d12f7ee08866d505260dca47800bb0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/profile_adapter.cpp')
-rw-r--r--src/core/profile_adapter.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp
index 50a97a6ac..1b946949a 100644
--- a/src/core/profile_adapter.cpp
+++ b/src/core/profile_adapter.cpp
@@ -53,6 +53,7 @@
#include "type_conversion.h"
#include "visited_links_manager_qt.h"
#include "web_engine_context.h"
+#include "web_contents_adapter_client.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
@@ -92,6 +93,9 @@ ProfileAdapter::ProfileAdapter(const QString &storageName):
ProfileAdapter::~ProfileAdapter()
{
+ while (!m_webContentsAdapterClients.isEmpty()) {
+ m_webContentsAdapterClients.first()->releaseProfile();
+ }
WebEngineContext::current()->removeProfileAdapter(this);
if (m_downloadManagerDelegate) {
m_profile->GetDownloadManager(m_profile.data())->Shutdown();
@@ -547,6 +551,16 @@ bool ProfileAdapter::isSpellCheckEnabled() const
#endif
}
+void ProfileAdapter::addWebContentsAdapterClient(WebContentsAdapterClient *client)
+{
+ m_webContentsAdapterClients.append(client);
+}
+
+void ProfileAdapter::removeWebContentsAdapterClient(WebContentsAdapterClient *client)
+{
+ m_webContentsAdapterClients.removeAll(client);
+}
+
void ProfileAdapter::resetVisitedLinksManager()
{
m_visitedLinksManager.reset(new VisitedLinksManagerQt(this));