From 20e00fdfc0708fec61c10162f0200cacc8341fcc Mon Sep 17 00:00:00 2001 From: xiaowei guan <60122246+xiaowei-guan@users.noreply.github.com> Date: Thu, 24 Aug 2023 15:36:46 +0800 Subject: [PATCH] Fix coredump issue during exit app (#43) --- flutter/shell/platform/tizen/flutter_tizen_engine.cc | 12 +++++++++--- flutter/shell/platform/tizen/flutter_tizen_engine.h | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/flutter/shell/platform/tizen/flutter_tizen_engine.cc b/flutter/shell/platform/tizen/flutter_tizen_engine.cc index b981ca1..46d1820 100644 --- a/flutter/shell/platform/tizen/flutter_tizen_engine.cc +++ b/flutter/shell/platform/tizen/flutter_tizen_engine.cc @@ -216,7 +216,10 @@ bool FlutterTizenEngine::RunEngine() { vsync_waiter_ = std::make_unique(this); args.vsync_callback = [](void* user_data, intptr_t baton) -> void { auto* engine = static_cast(user_data); - engine->vsync_waiter_->AsyncWaitForVsync(baton); + std::lock_guard lock(engine->vsync_mutex_); + if (engine->vsync_waiter_) { + engine->vsync_waiter_->AsyncWaitForVsync(baton); + } }; } #endif @@ -266,8 +269,11 @@ bool FlutterTizenEngine::StopEngine() { callback(registrar); } #ifndef WEARABLE_PROFILE - if (vsync_waiter_) { - vsync_waiter_.reset(); + { + std::lock_guard lock(vsync_mutex_); + if (vsync_waiter_) { + vsync_waiter_.reset(); + } } #endif FlutterEngineResult result = embedder_api_.Shutdown(engine_); diff --git a/flutter/shell/platform/tizen/flutter_tizen_engine.h b/flutter/shell/platform/tizen/flutter_tizen_engine.h index 6108d63..42d7119 100644 --- a/flutter/shell/platform/tizen/flutter_tizen_engine.h +++ b/flutter/shell/platform/tizen/flutter_tizen_engine.h @@ -272,6 +272,8 @@ class FlutterTizenEngine { std::unique_ptr renderer_; #ifndef WEARABLE_PROFILE + std::mutex vsync_mutex_; + // The vsync waiter for the embedder. std::unique_ptr vsync_waiter_; #endif