From 5eb3ba2dcbeaf1e9ce42439b5ba2b92389e6a640 Mon Sep 17 00:00:00 2001 From: Amartya Parijat Date: Mon, 31 Mar 2025 09:56:26 +0200 Subject: [PATCH] Fix Edge::getWebViewWrapper deadlock threat #1466 This commit makes sure while calling Edge::getWebViewWrapper with waitForPendingWebviewTasksToFinish set to true that the method also checks for the completion of the webViewWrapperFuture before calling a join() on it, which can some time lead to deadlock as we allow forced execptional completion of lastWebViewTask on timeout. contributes to https://github.com/eclipse-platform/eclipse.platform.swt/issues/1466 --- .../win32/org/eclipse/swt/browser/Edge.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/Edge.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/Edge.java index ddc7647303..53e90959ef 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/Edge.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/Edge.java @@ -405,13 +405,14 @@ private ICoreWebView2_13 initializeWebView_13(ICoreWebView2 webView) { } private WebViewWrapper getWebViewWrapper(boolean waitForPendingWebviewTasksToFinish) { + WebViewWrapper webViewWrapper = getWebViewWrapper(); if(waitForPendingWebviewTasksToFinish) { processOSMessagesUntil(lastWebViewTask::isDone, exception -> { lastWebViewTask.completeExceptionally(exception); throw exception; }, browser.getDisplay()); } - return webViewWrapperFuture.join(); + return webViewWrapper; } private WebViewWrapper getWebViewWrapper() {