Skip to content

Conversation

@swift-kim
Copy link
Member

@swift-kim swift-kim commented Sep 22, 2022

Potentially fixes flutter-tizen/flutter-tizen#232.

This change is just a partial revert of #317. In the PR, I changed tdm_client_ from a plain pointer to a shared_ptr which is shared between the platform thread and the vblank thread, but it turned out that it results in a synchronization issue in flutter-tizen/flutter-tizen#232 for some unknown reason. The main reason I changed it into a shared_ptr was that it seemed not safe to call OnEngineStop on a plain pointer because the object pointed by the pointer was being destroyed on thread exit. However, in reality, OnEngineStop is guaranteed to be called before a kMessageQuit message is sent and thus no segmentation fault should occur.

I also considered removing the vblank thread itself but thought it would not be very efficient since tdm_client_handle_events is a blocking call and blocks the UI thread.

@swift-kim swift-kim changed the title Do not call FlutterEngineOnVsync after engine shutdown Fix FlutterEngineOnVsync being called after engine shutdown Sep 23, 2022
@swift-kim
Copy link
Member Author

I changed tdm_client_ back to a share_ptr and just replaced reset() with OnEngineStop() according to @bbrto21's suggestion. The problem was that the instance was not destroyed when reset() was called and thus engine_ = nullptr; was not called as I expected. Thank you!

@swift-kim swift-kim merged commit f11f8f1 into flutter-tizen:flutter-3.3.0-tizen Sep 27, 2022
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.

OnVsync called after engine shutdown on emulator

2 participants