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

fix: Wait for the executor.dispose done before exit the isolate #93

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

littleGnAl
Copy link
Collaborator

@littleGnAl littleGnAl commented Jan 27, 2024

We send a null to the sub isolate the clean up the native resources(destroyNativeApiEngine...), but we do not wait for the clean-up logic to be finished, which will cause an error if we want to clean up something relative to the native resources right after the dispose function in sychronize way. For example the test cases from the agora_rtc_engine https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/blob/main/test_shard/fake_test_app/integration_test/apis_call_fake_test.dart

  testWidgets(
    'AudioDeviceManager.enumeratePlaybackDevices',
    (WidgetTester tester) async {
      ...
      await rtcEngine.release();
    },
  );

  tearDown(() {
    setMockRtcEngineProvider(null);
    // It's not safe to dispose here, since the `executor.dispose` inside the isolate may run after this dispose function.
    irisTester!.dispose(); 
    irisTester = null;
  });

@littleGnAl littleGnAl merged commit dc202d9 into main Jan 29, 2024
49 checks passed
@littleGnAl littleGnAl deleted the littlegnal/fix-dispose-not-wait-apiengine-destory branch January 29, 2024 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant