Skip to content

Commit

Permalink
Fix FlutterEngineOnVsync being called after engine shutdown (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
swift-kim authored Sep 27, 2022
1 parent e72a4b2 commit f11f8f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
19 changes: 10 additions & 9 deletions shell/platform/tizen/tizen_vsync_waiter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TizenVsyncWaiter::TizenVsyncWaiter(FlutterTizenEngine* engine) {
}

TizenVsyncWaiter::~TizenVsyncWaiter() {
tdm_client_.reset();
tdm_client_->OnEngineStop();

SendMessage(kMessageQuit, 0);

Expand Down Expand Up @@ -130,10 +130,6 @@ TdmClient::TdmClient(FlutterTizenEngine* engine) {
}

TdmClient::~TdmClient() {
{
std::lock_guard<std::mutex> lock(engine_mutex_);
engine_ = nullptr;
}
if (vblank_) {
tdm_client_vblank_destroy(vblank_);
vblank_ = nullptr;
Expand All @@ -145,6 +141,15 @@ TdmClient::~TdmClient() {
}
}

bool TdmClient::IsValid() {
return vblank_ && client_;
}

void TdmClient::OnEngineStop() {
std::lock_guard<std::mutex> lock(engine_mutex_);
engine_ = nullptr;
}

void TdmClient::AwaitVblank(intptr_t baton) {
baton_ = baton;
tdm_error ret = tdm_client_vblank_wait(vblank_, 1, VblankCallback, this);
Expand All @@ -155,10 +160,6 @@ void TdmClient::AwaitVblank(intptr_t baton) {
tdm_client_handle_events(client_);
}

bool TdmClient::IsValid() {
return vblank_ && client_;
}

void TdmClient::VblankCallback(tdm_client_vblank* vblank,
tdm_error error,
unsigned int sequence,
Expand Down
1 change: 1 addition & 0 deletions shell/platform/tizen/tizen_vsync_waiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class TdmClient {
virtual ~TdmClient();

bool IsValid();
void OnEngineStop();
void AwaitVblank(intptr_t baton);

private:
Expand Down

0 comments on commit f11f8f1

Please sign in to comment.