File tree 2 files changed +15
-5
lines changed
flutter/shell/platform/tizen/channels
2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -120,8 +120,13 @@ class AppControlManager {
120
120
return instance;
121
121
}
122
122
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 ;
125
130
}
126
131
127
132
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) {
58
58
FT_LOG (Error) << " Could not create an instance of AppControl." ;
59
59
return ;
60
60
}
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
+ }
61
67
if (event_sink_) {
62
- SendAppControlEvent (app_control. get () );
68
+ SendAppControlEvent (app_control_ptr );
63
69
} else {
64
70
FT_LOG (Info) << " No event channel has been set up." ;
65
- queue_.push (app_control. get () );
71
+ queue_.push (app_control_ptr );
66
72
}
67
- AppControlManager::GetInstance ().Insert (std::move (app_control));
68
73
}
69
74
70
75
void AppControlChannel::HandleMethodCall (
You can’t perform that action at this time.
0 commit comments