From bfc114b5c2abf8889e878f8bdb0c17b8bd50e9cf Mon Sep 17 00:00:00 2001 From: Boram Bae Date: Mon, 27 Jun 2022 18:28:45 +0900 Subject: [PATCH 1/2] Cleanup when destroying view and engine * The view should be responsible for the life cycle of the engine, and the engine should stop naturally when the view is destroyed. Signed-off-by: Boram Bae --- shell/platform/tizen/flutter_tizen_engine.cc | 1 + shell/platform/tizen/flutter_tizen_view.cc | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/shell/platform/tizen/flutter_tizen_engine.cc b/shell/platform/tizen/flutter_tizen_engine.cc index 7856f9303ec30..92e1dd66981df 100644 --- a/shell/platform/tizen/flutter_tizen_engine.cc +++ b/shell/platform/tizen/flutter_tizen_engine.cc @@ -91,6 +91,7 @@ FlutterTizenEngine::FlutterTizenEngine(const FlutterProjectBundle& project) } FlutterTizenEngine::~FlutterTizenEngine() { + StopEngine(); renderer_ = nullptr; } diff --git a/shell/platform/tizen/flutter_tizen_view.cc b/shell/platform/tizen/flutter_tizen_view.cc index 8a74cf25f4bd3..48d020eecdd8b 100644 --- a/shell/platform/tizen/flutter_tizen_view.cc +++ b/shell/platform/tizen/flutter_tizen_view.cc @@ -52,7 +52,9 @@ FlutterTizenView::FlutterTizenView(std::unique_ptr tizen_view) } } -FlutterTizenView::~FlutterTizenView() {} +FlutterTizenView::~FlutterTizenView() { + DestroyRenderSurface(); +} void FlutterTizenView::SetEngine(std::unique_ptr engine) { engine_ = std::move(engine); From db81bc7560b64f3ce4dd7c9fc1151b68f9e1a06b Mon Sep 17 00:00:00 2001 From: Boram Bae Date: Wed, 29 Jun 2022 09:18:48 +0900 Subject: [PATCH 2/2] Remove explicit null assignment from destructor * There is no need to explicitly assign null to a unique pointer in the destructor of engine. Signed-off-by: Boram Bae --- shell/platform/tizen/flutter_tizen_engine.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/shell/platform/tizen/flutter_tizen_engine.cc b/shell/platform/tizen/flutter_tizen_engine.cc index 92e1dd66981df..88b7ff2966fce 100644 --- a/shell/platform/tizen/flutter_tizen_engine.cc +++ b/shell/platform/tizen/flutter_tizen_engine.cc @@ -92,7 +92,6 @@ FlutterTizenEngine::FlutterTizenEngine(const FlutterProjectBundle& project) FlutterTizenEngine::~FlutterTizenEngine() { StopEngine(); - renderer_ = nullptr; } bool FlutterTizenEngine::RunEngine() {