Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swing Example Crashes #29

Open
SuperDino484 opened this issue Feb 29, 2024 · 9 comments
Open

Swing Example Crashes #29

SuperDino484 opened this issue Feb 29, 2024 · 9 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@SuperDino484
Copy link

The error is posted below. This happens when just running the Swing example from this repo.

Exception in thread "Thread-0" java.lang.Error: Invalid memory access at com.sun.jna.Native.invokeLong(Native Method) at com.sun.jna.Function.invoke(Function.java:431) at com.sun.jna.Function.invoke(Function.java:364) at com.sun.jna.Library$Handler.invoke(Library.java:270) at dev.webview.webview_java.$Proxy0.webview_create(Unknown Source) at dev.webview.webview_java.Webview.<init>(Webview.java:193) at dev.webview.webview_java.Webview.<init>(Webview.java:185) at dev.webview.webview_java.Webview.<init>(Webview.java:177) at dev.webview.webview_java.Webview$1.lambda$paint$0(Webview.java:77) at java.base/java.lang.Thread.run(Thread.java:833)

@e3ndr e3ndr added bug Something isn't working help wanted Extra attention is needed labels Mar 2, 2024
@e3ndr
Copy link
Contributor

e3ndr commented Mar 2, 2024

Yeah it looks like this was introduced in an update to the upstream library. Still trying to figure it out.

@Osiris-Team
Copy link

@e3ndr any updates on this?

@Osiris-Team
Copy link

So it definetly has something todo with this line:
$pointer = N.webview_create(debug, windowPointer);
when passing null as windowPointer it works (however opens a new windows like documented)
so there is probably something wrong with the windowPointer object.

@Osiris-Team
Copy link

Where do you get the binaries from? Maybe trying a newer version of webview fixes it.

@Osiris-Team
Copy link

Osiris-Team commented Aug 7, 2024

Reverting to the webview version in 1.3.0 seems to fix this issue. Maybe this even is even only related to the webview2loader.dll not being preset, who knows and maybe this is only a Windows issue.
Did that on my fork and replaced the libraries with the older versions. Note that not all were replaced since there are more supported architectures now.
https://github.com/Osiris-Team/webview_java
You can get it from here as a temporary workaround: https://jitpack.io/#Osiris-Team/webview_java/1.3.2

Use with 1JPM:

            implementation("com.github.Osiris-Team.webview_java:core:1.3.2");
            implementation("com.github.Osiris-Team.webview_java:bridge:1.3.2");

@e3ndr
Copy link
Contributor

e3ndr commented Aug 7, 2024

Where do you get the binaries from? Maybe trying a newer version of webview fixes it.

They were self-built. You can checkout this GH action to see how I was doing it.

any updates on this?

Unfortunately not, I have decided to step away from webview_java and have been meaning to get in contact with some people about someone taking over maintaining.

@Link-Kou
Copy link

@e3ndr Support Swing

@e3ndr
Copy link
Contributor

e3ndr commented Aug 15, 2024

@Osiris-Team if you're willing to contribute, i believe the issue is weak references to the native callback interfaces. basically, the JVM will garbage collect those callbacks since the function is returning. i don't think that fixes the swing issue but it might be related.

@Osiris-Team
Copy link

@e3ndr I would love to. However I have no idea what that even means, and since I got it working by downgrading the dll there is little motivation for me to fix that haha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants