From d7a7663c58fa81b04b2acc63c3e672fce2f46116 Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Mon, 10 Feb 2020 17:28:11 +0100 Subject: Fix crashes in urlChanged signal handlers If a user initiates page load from a urlChanged signal handler after a failed navigation while still being in NavigationRequest::OnRequestFailedInternal(), the new page load can discard the pending navigation entry and delete the NavigationRequest instance before finishing execution of OnRequestFailedInternal(). Fix crash by returning to the event loop before emitting urlChanged signal. Task-number: QTBUG-78490 Change-Id: I849a609f5524d715769079f6c5cabf8db6b45944 Reviewed-by: Michal Klocek --- src/webengine/api/qquickwebengineview.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 8097689ad..60aaead67 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -356,7 +356,9 @@ void QQuickWebEngineViewPrivate::urlChanged(const QUrl &url) { Q_Q(QQuickWebEngineView); Q_UNUSED(url); - Q_EMIT q->urlChanged(); + QTimer::singleShot(0, q, [q]() { + Q_EMIT q->urlChanged(); + }); } void QQuickWebEngineViewPrivate::iconChanged(const QUrl &url) -- cgit v1.2.3