Skip to content

Commit

Permalink
fix: [native] Fix errors when hot restarted
Browse files Browse the repository at this point in the history
  • Loading branch information
littleGnAl committed Sep 13, 2023
1 parent 1d5d8f9 commit 8c352d8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ jobs:
- name: run macos integration test
run: |
flutter packages get
flutter test integration_test/iris_event_smoke_test.dart -d macos
flutter test integration_test -d macos
working-directory: example

integration_test_android:
Expand Down
4 changes: 2 additions & 2 deletions example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ void main() {
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) => widget is Text &&
widget.data!.startsWith('Running on:'),
(Widget widget) =>
widget is Text && widget.data!.startsWith('Running on:'),
),
findsOneWidget,
);
Expand Down
12 changes: 7 additions & 5 deletions lib/src/platform/io/iris_method_channel_internal_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,16 @@ class _HotRestartFinalizer {
nativeBindingDelegate.initialize();

nativeBindingDelegate.destroyNativeApiEngine(IrisApiEngineHandle(
ffi.Pointer.fromAddress(_debugIrisApiEngineNativeHandle!)));
ffi.Pointer<ffi.Void>.fromAddress(_debugIrisApiEngineNativeHandle!)));

calloc.free(ffi.Pointer.fromAddress(_debugIrisCEventHandlerNativeHandle!));
calloc.free(ffi.Pointer<ffi.Void>.fromAddress(
_debugIrisCEventHandlerNativeHandle!));
nativeBindingDelegate.destroyIrisEventHandler(IrisEventHandlerHandle(
ffi.Pointer.fromAddress(_debugIrisEventHandlerNativeHandle!)));
ffi.Pointer<ffi.Void>.fromAddress(
_debugIrisEventHandlerNativeHandle!)));

assert(provider.provideIrisEvent() != null);
final irisEvent = provider.provideIrisEvent()! as IrisEventIO;
final irisEvent =
(provider.provideIrisEvent() ?? IrisEventIO()) as IrisEventIO;
irisEvent.dispose();

_onExitSubscription?.cancel();
Expand Down
2 changes: 1 addition & 1 deletion lib/src/platform/utils_expect.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:typed_data';

/// Stub function for translate the int ptr to the [Uint8List].
/// Stub function for translate the int ptr to the [Uint8List].
/// See implementation:
/// io: `io/utils_actual_io.dart`
/// web: `web/utils_actual_web.dart`(Empty implementation)
Expand Down
2 changes: 1 addition & 1 deletion test/platform/platform_cases.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export 'platform_cases_expect.dart'
if (dart.library.io) 'platform_cases_actual_io.dart'
if (dart.library.io) 'platform_cases_actual_io.dart'
if (dart.library.html) 'platform_cases_actual_web.dart';

0 comments on commit 8c352d8

Please sign in to comment.