alibaba / alibaba/flutter_boost
如何安全的销毁 FlutterBoost ?
- Dominant language
- Dart
- Stars
- 7.2k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
```
java.lang.RuntimeException: state error
at com.idlefish.flutterboost.Debuger.exception(SourceFile:53)
at com.idlefish.flutterboost.ContainerRecord.onDestroy(SourceFile:125)
at com.idlefish.flutterboost.containers.FlutterActivityAndFragmentDelegate.onDestroyView(SourceFile:217)
at com.idlefish.flutterboost.containers.FlutterFragment.onDestroyView(SourceFile:301)
at androidx.fragment.app.Fragment.performDestroyView(SourceFile:2908)
at androidx.fragment.app.FragmentManager.destroyFragmentView(SourceFile:1342)
at androidx.fragment.app.FragmentManager.moveToState(SourceFile:1262)
at androidx.fragment.app.FragmentManager.moveToState(SourceFile:1354)
at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(SourceFile:1432)
at androidx.fragment.app.FragmentManager.moveToState(SourceFile:1495)
at androidx.fragment.app.FragmentManager.dispatchStateChange(SourceFile:2617)
at androidx.fragment.app.FragmentManager.dispatchDestroy(SourceFile:2601)
at androidx.fragment.app.FragmentController.dispatchDestroy(SourceFile:330)
at androidx.fragment.app.FragmentActivity.onDestroy(SourceFile:365)
at androidx.appcompat.app.AppCompatActivity.onDestroy(SourceFile:242)
at solid.ren.skinlibrary.base.SkinBaseActivity.onDestroy(SourceFile:53)
at com.base.BaseActivity.onDestroy(SourceFile:366)
at com.home.MainActivity.onDestroy(SourceFile:395)
at android.app.Activity.performDestroy(Activity.java:8254)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1341)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5283)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5327)
at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:181)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:102)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2239)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7830)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1040)
```
在MainActivity 的 onDestroy 的时候,执行的是:版本是 (v1.12.13+hotfix.9)
```
FlutterEngine flutterEngine = FlutterBoost.instance().engineProvider();
if (flutterEngine != null) {
if (flutterEngine.getLifecycleChannel() != null) {
flutterEngine.getLifecycleChannel().appIsDetached();
}
if (flutterEngine.getPlatformViewsController() != null) {
flutterEngine.getPlatformViewsController().onFlutterViewDestroyed();
}
}
FlutterBoost.instance().boostDestroy();
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing MainActivity.onDestroy through FlutterBoost.instance().boostDestroy(), FlutterFragment.onDestroyView, FlutterActivityAndFragmentDelegate.onDestroyView, and ContainerRecord.onDestroy. Reproduce the lifecycle sequence using the reported FlutterBoost v1.12.13+hotfix.9 code and determine what prevents the state error during destruction; done means the activity can be destroyed without the reported RuntimeException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, dart, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100