Skip to content

Commit

Permalink
Add lock for thread safe
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaowei-guan committed Aug 22, 2023
1 parent aebd688 commit 0408363
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions flutter/shell/platform/tizen/flutter_tizen_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ bool FlutterTizenEngine::RunEngine() {
vsync_waiter_ = std::make_unique<TizenVsyncWaiter>(this);
args.vsync_callback = [](void* user_data, intptr_t baton) -> void {
auto* engine = static_cast<FlutterTizenEngine*>(user_data);
std::lock_guard<std::mutex> lock(engine->vsync_mutex_);
if (engine->vsync_waiter_) {
engine->vsync_waiter_->AsyncWaitForVsync(baton);
}
Expand Down Expand Up @@ -268,6 +269,7 @@ bool FlutterTizenEngine::StopEngine() {
callback(registrar);
}
#ifndef WEARABLE_PROFILE
std::lock_guard<std::mutex> lock(vsync_mutex_);
if (vsync_waiter_) {
vsync_waiter_.reset();
}
Expand Down
1 change: 1 addition & 0 deletions flutter/shell/platform/tizen/flutter_tizen_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ class FlutterTizenEngine {
std::unique_ptr<TizenRenderer> renderer_;

#ifndef WEARABLE_PROFILE
std::mutex vsync_mutex_;
// The vsync waiter for the embedder.
std::unique_ptr<TizenVsyncWaiter> vsync_waiter_;
#endif
Expand Down

0 comments on commit 0408363

Please sign in to comment.