Skip to content

Commit 1ee8024

Browse files
amartya4256HeikoKlare
authored andcommitted
Store Edge instance in Environemnt record sync-ly
This commit stores the edge instance on creation in the webenvironment record synchronously for the sake of the consistency of the record. contributes to #1592
1 parent 0e7f799 commit 1ee8024

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
@@ -568,6 +568,7 @@ private String getDataDir(Display display) {
568568
@Override
569569
public void create(Composite parent, int style) {
570570
containingEnvironment = createEnvironment();
571+
containingEnvironment.instances().add(this);
571572
long[] ppv = new long[1];
572573
int hr = containingEnvironment.environment().QueryInterface(COM.IID_ICoreWebView2Environment2, ppv);
573574
if (hr == COM.S_OK) environment2 = new ICoreWebView2Environment2(ppv[0]);
@@ -591,9 +592,11 @@ void setupBrowser(int hr, long pv) {
591592
case COM.S_OK:
592593
break;
593594
case COM.E_WRONG_THREAD:
595+
containingEnvironment.instances().remove(this);
594596
error(SWT.ERROR_THREAD_INVALID_ACCESS, hr);
595597
break;
596598
default:
599+
containingEnvironment.instances().remove(this);
597600
error(SWT.ERROR_NO_HANDLES, hr);
598601
}
599602
long[] ppv = new long[] {pv};
@@ -688,7 +691,6 @@ void setupBrowser(int hr, long pv) {
688691
browser.addListener(SWT.Move, this::browserMove);
689692
scheduleMouseMovementHandling();
690693

691-
containingEnvironment.instances().add(this);
692694
// Sometimes when the shell of the browser is opened before the browser is
693695
// initialized, nothing is drawn on the shell. We need browserResize to force
694696
// the shell to draw itself again.

0 commit comments

Comments
 (0)