Skip to content

Commit fc94eaf

Browse files
amartya4256fedejeanne
authored andcommitted
Release Edge callbacks after registering #2339
This commit releases the HandleCoreWebView2SwtCallback resource created by Edge browser in createControllerInitializationCallback after it has been registered by CreateCoreWebView2Controller method as otherwise the HandleCoreWebView2SwtCallback object can cause memory leaks if left unreleased. fixes #2339
1 parent bcc58ad commit fc94eaf

File tree

1 file changed

+3
-1
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser

1 file changed

+3
-1
lines changed

bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/Edge.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,9 @@ private void createInstance(int previousAttempts) {
662662
int hr = containingEnvironment.environment().QueryInterface(COM.IID_ICoreWebView2Environment2, ppv);
663663
if (hr == COM.S_OK) environment2 = new ICoreWebView2Environment2(ppv[0]);
664664
// The webview calls are queued to be executed when it is done executing the current task.
665-
containingEnvironment.environment().CreateCoreWebView2Controller(browser.handle, createControllerInitializationCallback(previousAttempts));
665+
IUnknown controllerInitializationHandler = createControllerInitializationCallback(previousAttempts);
666+
containingEnvironment.environment().CreateCoreWebView2Controller(browser.handle, controllerInitializationHandler);
667+
controllerInitializationHandler.Release();
666668
}
667669

668670
private IUnknown createControllerInitializationCallback(int previousAttempts) {

0 commit comments

Comments
 (0)