-
Notifications
You must be signed in to change notification settings - Fork 6k
Fix flutter/flutter#26660 #7531
Fix flutter/flutter#26660 #7531
Conversation
|
I'm not sure this is the right fix - when I try it locally I don't get a crash anymore, but I also don't get back to the original viewcontroller.... |
|
@dnfield |
|
Something's broken, I agree. I'm trying to figure out how to fix this and not break the previous problem :) |
Are you saying https://github.com/KevinTheGray/flutterissues? |
|
See git@github.com:kangwang1988/flutterissues.git But I do think this is another problem. |
|
Ahh I missed something in there. I had a really hectic day today, but I'll take a closer look at this soon - sorry for the delay. |
Never mind. |
|
|
||
| if (_engineNeedsLaunch) { | ||
| if (_isEmbedEngine) { | ||
| [_engine.get() createShell:nil libraryURI:nil]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure this will lead to unexpected loss of state. If we allow the engine to get torn down here, restarting it will prevent th ecrash but also restart the app from scratch.
dnfield
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate this PR - it helped me understand the problem better for sure. However, I think to really get at this we should override the present methods on FlutterViewController to make sur ethe engine doesn't disappear in those scenarios. What do you think?
|
@dnfield Besides, I don't think it's a good idea to process the logic depending on the dealloc seems a better function to do this. Can we add an external api exposed to developers so that we can still break the recycle retain, and don't call it from the default intra logic? |
|
Can you take a look at #7544? I agree with you that overriding those methods is probably not the way to go - this is a little bit different. |
|
@dnfield |
When the engine is a embedder engine(not passed by developers), the shell is destroyed on disappearing. However, when FlutterVC present a NativeVC and go back, the shell needs to be created again. Otherwise, it will crash due to null shell assert.