Skip to content

Commit 94e9fe5

Browse files
HeikoKlarevogella
authored andcommitted
Distinguish Edge instantiation error due to invalid thread access #1013
Instead of always showing a "no more handles" error, with this change an error due to invalid thread access is explicitly logged as such. Contributes to #1013
1 parent 9dceec0 commit 94e9fe5

File tree

2 files changed

+10
-1
lines changed
  • bundles/org.eclipse.swt
    • Eclipse SWT Browser/win32/org/eclipse/swt/browser
    • Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32

2 files changed

+10
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,15 @@ public void create(Composite parent, int style) {
359359
if (hr == COM.S_OK) environment2 = new ICoreWebView2Environment2(ppv[0]);
360360

361361
hr = callAndWait(ppv, completion -> environment.CreateCoreWebView2Controller(browser.handle, completion));
362-
if (hr != COM.S_OK) error(SWT.ERROR_NO_HANDLES, hr);
362+
switch (hr) {
363+
case COM.S_OK:
364+
break;
365+
case COM.E_WRONG_THREAD:
366+
error(SWT.ERROR_THREAD_INVALID_ACCESS, hr);
367+
break;
368+
default:
369+
error(SWT.ERROR_NO_HANDLES, hr);
370+
}
363371
controller = new ICoreWebView2Controller(ppv[0]);
364372

365373
controller.get_CoreWebView2(ppv);

bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ public class COM extends OS {
186186
public static final int E_NOTIMPL = -2147467263;
187187
public static final int E_NOTSUPPORTED = 0x80040100;
188188
public static final int E_OUTOFMEMORY = -2147024882;
189+
public static final int E_WRONG_THREAD = 0x802a000c;
189190
public static final int GMEM_FIXED = 0;
190191
public static final int GMEM_ZEROINIT = 64;
191192
public static final int GUIDKIND_DEFAULT_SOURCE_DISP_IID = 1;

0 commit comments

Comments
 (0)