wails icon indicating copy to clipboard operation
wails copied to clipboard

Improve go-webview2 com object release

Open Snshadow opened this issue 1 year ago • 6 comments

This is a followup from https://github.com/wailsapp/go-webview2/pull/25#issuecomment-2513894748 which couldn't be fixed properly as wails build fails in Windows if it were changed.

The cause of the build failure is due to these codes that expects error return from Release function which only returns reference count as a uint32 value, not an error, which can cause unexpected erroring as Proc.Call states that

The returned error is always non-nil, constructed from the result of GetLastError. Callers must inspect the primary return value to decide whether an error occurred (according to the semantics of the specific function being called) before consulting the error. The error always has type Errno.

These parts expect Release to return an error which prevent building from succeeding.

  • https://github.com/wailsapp/wails/blob/6345b64a2241804389778d363ddee27076662f2a/v2/pkg/assetserver/webview/request_windows.go#L125-L127
  • https://github.com/wailsapp/wails/blob/6345b64a2241804389778d363ddee27076662f2a/v2/pkg/assetserver/webview/request_windows.go#L135-L137
  • https://github.com/wailsapp/wails/blob/6345b64a2241804389778d363ddee27076662f2a/v2/pkg/assetserver/webview/request_windows.go#L155-L161

If this were to be fixed, wails and go-webview2 would need to be fixed at the same time(as wails depends on go-webview2).

Snshadow avatar Dec 05 '24 01:12 Snshadow