]> uap-core.de Git - rssreader.git/commitdiff
fix illegal arguments in webview loadContent
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Thu, 21 Aug 2025 16:30:25 +0000 (18:30 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Thu, 21 Aug 2025 16:30:25 +0000 (18:30 +0200)
ui-java/src/main/java/de/unixwork/ui/WebView.java
ui-java/src/main/java/de/unixwork/ui/WebViewFuncs.java

index 4a13ff499da50560394da04b1ec151508381f94b..cd3e311d7d639277ce0b26df1a8005b971a51327 100644 (file)
@@ -40,6 +40,7 @@ public class WebView {
         try (Arena arena = Arena.ofConfined()) {
             MemorySegment uriCStr = MemorySegment.NULL;
             MemorySegment contentCStr = MemorySegment.NULL;
+            long contentLength = 0;
             MemorySegment mimeTypeCStr = MemorySegment.NULL;
             MemorySegment encodingCStr = MemorySegment.NULL;
             if(uri != null) {
@@ -47,6 +48,7 @@ public class WebView {
             }
             if(content != null) {
                 contentCStr = arena.allocateFrom(content);
+                contentLength = content.length();
             }
             if(mimeType != null) {
                 mimeTypeCStr = arena.allocateFrom(mimeType);
@@ -54,7 +56,7 @@ public class WebView {
             if(encoding != null) {
                 encodingCStr = arena.allocateFrom(encoding);
             }
-            ui.webview_load_content.invoke(valuePtr, uriCStr, contentCStr, mimeTypeCStr, encodingCStr);
+            ui.webview_load_content.invoke(valuePtr, uriCStr, contentCStr, contentLength, mimeTypeCStr, encodingCStr);
         } catch (Throwable e) {
             throw new RuntimeException(e);
         }
index 5ecba207dfdc500917beb31ba11229745a90d1b1..7279bd410b604fa9d0bae2f196d67b00acedf9fe 100644 (file)
@@ -48,7 +48,7 @@ public class WebViewFuncs {
         webview_load_content = linker.downcallHandle(
                 ui_webview_load_content_addr,
                 FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS,
-                                          ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS));
+                                          ValueLayout.JAVA_LONG, ValueLayout.ADDRESS, ValueLayout.ADDRESS));
         webview_reload = linker.downcallHandle(ui_webview_reload_addr, sigv_m);
         webview_can_go_back = linker.downcallHandle(ui_webview_can_go_back_addr, sigb_m);
         webview_can_go_forward = linker.downcallHandle(ui_webview_can_go_forward_addr, sigb_m);