summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-01-15 16:47:06 +0100
committerJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-01-28 16:53:12 +0000
commit64da0f73b2f8a2f936113fd556c9477cea441ded (patch)
tree8b30dbde7120d758eba444234806bc7e26909f1d /tests
parent97c17e70cf984839c6e95d8f09a55f8d1e61b42e (diff)
Fix crash on exit for view-owned QWebEngineUrlSchemeHandler objects
For view-owned URL scheme handlers the destructor would remove the handler and then trigger URLRequestContextGetterQt::generateStorage. This would access the browser context from the IO thread while it already has been destroyed on the browser thread. Increment the ref count for the browser context before every call of generateStorage, and decrement it when generateStorage is finished. Task-number: QTBUG-50160 Change-Id: Id8b1505891ec56e93bf9d47f33bb8bc3304eb55a Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
index 0ad460634..99182f155 100644
--- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
+++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
@@ -146,6 +146,13 @@ void tst_QWebEngineProfile::urlSchemeHandlers()
view.load(url);
QVERIFY(loadFinishedSpy.wait());
QVERIFY(toPlainTextSync(view.page()) != url.toString());
+
+ // Install a handler that is owned by the view. Make sure this doesn't crash on shutdown.
+ profile.installUrlSchemeHandler("aviancarrier", new ReplyingUrlSchemeHandler(&view));
+ url = QUrl(QStringLiteral("aviancarrier:inspector.mortensen@politistyrke.dk"));
+ view.load(url);
+ QVERIFY(loadFinishedSpy.wait());
+ QCOMPARE(toPlainTextSync(view.page()), url.toString());
}
class FailingUrlSchemeHandler : public QWebEngineUrlSchemeHandler