Skip to content

Commit

Permalink
Store Edge instance in Environemnt record sync-ly
Browse files Browse the repository at this point in the history
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
  • Loading branch information
amartya4256 authored and HeikoKlare committed Nov 13, 2024
1 parent 0e7f799 commit 33188fe
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ private String getDataDir(Display display) {
@Override
public void create(Composite parent, int style) {
containingEnvironment = createEnvironment();
containingEnvironment.instances().add(this);
long[] ppv = new long[1];
int hr = containingEnvironment.environment().QueryInterface(COM.IID_ICoreWebView2Environment2, ppv);
if (hr == COM.S_OK) environment2 = new ICoreWebView2Environment2(ppv[0]);
Expand All @@ -591,9 +592,11 @@ void setupBrowser(int hr, long pv) {
case COM.S_OK:
break;
case COM.E_WRONG_THREAD:
containingEnvironment.instances().remove(this);
error(SWT.ERROR_THREAD_INVALID_ACCESS, hr);
break;
default:
containingEnvironment.instances().remove(this);
error(SWT.ERROR_NO_HANDLES, hr);
}
long[] ppv = new long[] {pv};
Expand Down Expand Up @@ -688,7 +691,6 @@ void setupBrowser(int hr, long pv) {
browser.addListener(SWT.Move, this::browserMove);
scheduleMouseMovementHandling();

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

0 comments on commit 33188fe

Please sign in to comment.