From 348848837a5e3a8f19148455fa6baa116876cda2 Mon Sep 17 00:00:00 2001 From: ekibun Date: Wed, 2 Dec 2020 11:39:21 +0800 Subject: [PATCH] fix crash on android x86 --- CHANGELOG.md | 7 ++++++- cxx/ffi.cpp | 3 +-- cxx/quickjs | 2 +- example/lib/main.dart | 4 ++-- example/pubspec.lock | 40 ++++++++++++++++++++-------------------- lib/ffi.dart | 10 +++++----- lib/wrapper.dart | 4 ++-- pubspec.lock | 38 +++++++++++++++++++------------------- pubspec.yaml | 2 +- 9 files changed, 57 insertions(+), 53 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ce62e6..307ed5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,13 @@ * @Author: ekibun * @Date: 2020-08-08 08:16:50 * @LastEditors: ekibun - * @LastEditTime: 2020-10-06 23:18:19 + * @LastEditTime: 2020-12-02 11:36:40 --> + +## 0.1.4 + +* fix crash on android x86. + ## 0.1.3 * fix randomly crash by stack overflow. diff --git a/cxx/ffi.cpp b/cxx/ffi.cpp index f23f859..5b8c186 100644 --- a/cxx/ffi.cpp +++ b/cxx/ffi.cpp @@ -3,7 +3,7 @@ * @Author: ekibun * @Date: 2020-09-06 18:32:45 * @LastEditors: ekibun - * @LastEditTime: 2020-10-07 00:03:41 + * @LastEditTime: 2020-12-02 11:11:42 */ #include "ffi.h" #include @@ -197,7 +197,6 @@ extern "C" DLLEXPORT const char *jsToCString(JSContext *ctx, JSValueConst *val) { - JS_ResetStackTop(JS_GetRuntime(ctx)); return JS_ToCString(ctx, *val); } diff --git a/cxx/quickjs b/cxx/quickjs index 5e8a1f4..5143636 160000 --- a/cxx/quickjs +++ b/cxx/quickjs @@ -1 +1 @@ -Subproject commit 5e8a1f421c00a8aa1d0af2dffd14b30d45832b83 +Subproject commit 5143636b2db8183cd45e6143d3e7d32d182e78d8 diff --git a/example/lib/main.dart b/example/lib/main.dart index 7d89ef0..3717589 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -3,7 +3,7 @@ * @Author: ekibun * @Date: 2020-08-08 08:16:51 * @LastEditors: ekibun - * @LastEditTime: 2020-10-03 21:37:22 + * @LastEditTime: 2020-12-02 11:28:06 */ import 'package:flutter/material.dart'; import 'dart:typed_data'; @@ -112,7 +112,7 @@ class _TestPageState extends State { setState(() {}); }), FlatButton( - child: Text("close engine"), + child: Text("reset engine"), onPressed: () async { if (engine == null) return; await engine.close(); diff --git a/example/pubspec.lock b/example/pubspec.lock index 681f5fa..3b5e630 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,42 +7,42 @@ packages: name: async url: "https://pub.flutter-io.cn" source: hosted - version: "2.5.0-nullsafety.1" + version: "2.5.0-nullsafety.3" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0-nullsafety.3" characters: dependency: transitive description: name: characters url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0-nullsafety.5" charcode: dependency: transitive description: name: charcode url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0-nullsafety.3" clock: dependency: transitive description: name: clock url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0-nullsafety.3" collection: dependency: transitive description: name: collection url: "https://pub.flutter-io.cn" source: hosted - version: "1.15.0-nullsafety.3" + version: "1.15.0-nullsafety.5" dio: dependency: "direct main" description: @@ -56,7 +56,7 @@ packages: name: fake_async url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0-nullsafety.3" ffi: dependency: transitive description: @@ -82,7 +82,7 @@ packages: path: ".." relative: true source: path - version: "0.1.3" + version: "0.1.4" flutter_test: dependency: "direct dev" description: flutter @@ -108,21 +108,21 @@ packages: name: matcher url: "https://pub.flutter-io.cn" source: hosted - version: "0.12.10-nullsafety.1" + version: "0.12.10-nullsafety.3" meta: dependency: transitive description: name: meta url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0-nullsafety.6" path: dependency: transitive description: name: path url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.0-nullsafety.1" + version: "1.8.0-nullsafety.3" sky_engine: dependency: transitive description: flutter @@ -134,56 +134,56 @@ packages: name: source_span url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.0-nullsafety.4" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.flutter-io.cn" source: hosted - version: "1.10.0-nullsafety.2" + version: "1.10.0-nullsafety.6" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0-nullsafety.3" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0-nullsafety.3" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0-nullsafety.3" test_api: dependency: transitive description: name: test_api url: "https://pub.flutter-io.cn" source: hosted - version: "0.2.19-nullsafety.2" + version: "0.2.19-nullsafety.6" typed_data: dependency: transitive description: name: typed_data url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0-nullsafety.5" vector_math: dependency: transitive description: name: vector_math url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0-nullsafety.5" sdks: - dart: ">=2.10.0-110 <=2.11.0-181.0.dev" + dart: ">=2.12.0-0.0 <3.0.0" flutter: ">=1.20.0 <2.0.0" diff --git a/lib/ffi.dart b/lib/ffi.dart index 3950114..1968d18 100644 --- a/lib/ffi.dart +++ b/lib/ffi.dart @@ -3,7 +3,7 @@ * @Author: ekibun * @Date: 2020-09-19 10:29:04 * @LastEditors: ekibun - * @LastEditTime: 2020-10-06 23:13:13 + * @LastEditTime: 2020-12-02 11:14:35 */ import 'dart:ffi'; import 'dart:io'; @@ -199,7 +199,7 @@ final Pointer Function( Pointer Function( Pointer, Pointer, - Int64, + IntPtr, Pointer, Int32, )>>("jsEval") @@ -330,7 +330,7 @@ final Pointer Function( Pointer Function( Pointer, Pointer, - Uint64, + IntPtr, )>>("jsNewArrayBufferCopy") .asFunction(); @@ -487,14 +487,14 @@ String jsToCString( /// uint8_t *jsGetArrayBuffer(JSContext *ctx, size_t *psize, JSValueConst *obj) final Pointer Function( Pointer ctx, - Pointer psize, + Pointer psize, Pointer val, ) jsGetArrayBuffer = qjsLib .lookup< NativeFunction< Pointer Function( Pointer, - Pointer, + Pointer, Pointer, )>>("jsGetArrayBuffer") .asFunction(); diff --git a/lib/wrapper.dart b/lib/wrapper.dart index 923b1d1..df92656 100644 --- a/lib/wrapper.dart +++ b/lib/wrapper.dart @@ -3,7 +3,7 @@ * @Author: ekibun * @Date: 2020-09-19 22:07:47 * @LastEditors: ekibun - * @LastEditTime: 2020-10-03 23:27:36 + * @LastEditTime: 2020-12-02 11:14:03 */ import 'dart:async'; import 'dart:ffi'; @@ -212,7 +212,7 @@ dynamic jsToDart(Pointer ctx, Pointer val, {Map cache}) { case JSTag.STRING: return jsToCString(ctx, val); case JSTag.OBJECT: - Pointer psize = allocate(); + Pointer psize = allocate(); Pointer buf = jsGetArrayBuffer(ctx, psize, val); int size = psize.value; free(psize); diff --git a/pubspec.lock b/pubspec.lock index 65c7e4f..02fb490 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,49 +7,49 @@ packages: name: async url: "https://pub.flutter-io.cn" source: hosted - version: "2.5.0-nullsafety.1" + version: "2.5.0-nullsafety.3" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0-nullsafety.3" characters: dependency: transitive description: name: characters url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0-nullsafety.5" charcode: dependency: transitive description: name: charcode url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0-nullsafety.3" clock: dependency: transitive description: name: clock url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0-nullsafety.3" collection: dependency: transitive description: name: collection url: "https://pub.flutter-io.cn" source: hosted - version: "1.15.0-nullsafety.3" + version: "1.15.0-nullsafety.5" fake_async: dependency: transitive description: name: fake_async url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0-nullsafety.3" ffi: dependency: "direct main" description: @@ -73,21 +73,21 @@ packages: name: matcher url: "https://pub.flutter-io.cn" source: hosted - version: "0.12.10-nullsafety.1" + version: "0.12.10-nullsafety.3" meta: dependency: transitive description: name: meta url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0-nullsafety.6" path: dependency: transitive description: name: path url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.0-nullsafety.1" + version: "1.8.0-nullsafety.3" sky_engine: dependency: transitive description: flutter @@ -99,56 +99,56 @@ packages: name: source_span url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.0-nullsafety.4" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.flutter-io.cn" source: hosted - version: "1.10.0-nullsafety.2" + version: "1.10.0-nullsafety.6" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0-nullsafety.3" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0-nullsafety.3" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0-nullsafety.3" test_api: dependency: transitive description: name: test_api url: "https://pub.flutter-io.cn" source: hosted - version: "0.2.19-nullsafety.2" + version: "0.2.19-nullsafety.6" typed_data: dependency: transitive description: name: typed_data url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0-nullsafety.5" vector_math: dependency: transitive description: name: vector_math url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0-nullsafety.5" sdks: - dart: ">=2.10.0-110 <=2.11.0-181.0.dev" + dart: ">=2.12.0-0.0 <3.0.0" flutter: ">=1.20.0 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index c44dee1..aaa237b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_qjs description: This plugin is a simple js engine for flutter using the `quickjs` project. Plugin currently supports all the platforms except web! -version: 0.1.3 +version: 0.1.4 homepage: https://github.com/ekibun/flutter_qjs environment: