Skip to content

Commit 7e89462

Browse files
authored
Clean-up channel view resource upon exiting app (#22)
Signed-off-by: MuHong Byun <[email protected]>
1 parent ca52fc7 commit 7e89462

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

shell/platform/tizen/channels/platform_view_channel.cc

+8-7
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,20 @@ PlatformViewChannel::PlatformViewChannel(flutter::BinaryMessenger* messenger)
7474
result) { HandleMethodCall(call, std::move(result)); });
7575
}
7676

77-
PlatformViewChannel::~PlatformViewChannel() {
78-
// Clean-up view_factories_
79-
for (auto const& [viewType, viewFactory] : view_factories_) {
80-
viewFactory->Dispose();
81-
}
82-
view_factories_.clear();
77+
PlatformViewChannel::~PlatformViewChannel() { Dispose(); }
8378

79+
void PlatformViewChannel::Dispose() {
8480
// Clean-up view_instances_
8581
for (auto const& [viewId, viewInstance] : view_instances_) {
86-
viewInstance->Dispose();
8782
delete viewInstance;
8883
}
8984
view_instances_.clear();
85+
86+
// Clean-up view_factories_
87+
for (auto const& [viewType, viewFactory] : view_factories_) {
88+
viewFactory->Dispose();
89+
}
90+
view_factories_.clear();
9091
}
9192

9293
void PlatformViewChannel::SendKeyEvent(Ecore_Event_Key* key, bool is_down) {

shell/platform/tizen/channels/platform_view_channel.h

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class PlatformViewChannel {
1919
public:
2020
explicit PlatformViewChannel(flutter::BinaryMessenger* messenger);
2121
virtual ~PlatformViewChannel();
22+
void Dispose();
2223
std::map<std::string, std::unique_ptr<PlatformViewFactory>>& ViewFactories() {
2324
return view_factories_;
2425
}

shell/platform/tizen/tizen_embedder_engine.cc

+3
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ bool TizenEmbedderEngine::RunEngine(
200200

201201
bool TizenEmbedderEngine::StopEngine() {
202202
if (flutter_engine) {
203+
if (platform_view_channel) {
204+
platform_view_channel->Dispose();
205+
}
203206
if (plugin_registrar_destruction_callback_) {
204207
plugin_registrar_destruction_callback_(plugin_registrar_.get());
205208
}

0 commit comments

Comments
 (0)