File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
flutter/shell/platform/tizen/channels Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -120,8 +120,13 @@ class AppControlManager {
120120 return instance;
121121 }
122122
123- void Insert (std::unique_ptr<AppControl> app_control) {
124- map_.insert ({app_control->id (), std::move (app_control)});
123+ // Returns a pointer to the inserted element if successful, otherwise nullptr.
124+ AppControl* Insert (std::unique_ptr<AppControl> app_control) {
125+ auto iter = map_.emplace (app_control->id (), std::move (app_control));
126+ if (iter.second ) {
127+ return iter.first ->second .get ();
128+ }
129+ return nullptr ;
125130 }
126131
127132 void Remove (int32_t id) { map_.erase (id); }
Original file line number Diff line number Diff line change @@ -58,13 +58,18 @@ void AppControlChannel::NotifyAppControl(void* handle) {
5858 FT_LOG (Error) << " Could not create an instance of AppControl." ;
5959 return ;
6060 }
61+ AppControl* app_control_ptr =
62+ AppControlManager::GetInstance ().Insert (std::move (app_control));
63+ if (!app_control_ptr) {
64+ FT_LOG (Error) << " The handle already exists." ;
65+ return ;
66+ }
6167 if (event_sink_) {
62- SendAppControlEvent (app_control. get () );
68+ SendAppControlEvent (app_control_ptr );
6369 } else {
6470 FT_LOG (Info) << " No event channel has been set up." ;
65- queue_.push (app_control. get () );
71+ queue_.push (app_control_ptr );
6672 }
67- AppControlManager::GetInstance ().Insert (std::move (app_control));
6873}
6974
7075void AppControlChannel::HandleMethodCall (
You can’t perform that action at this time.
0 commit comments