diff options
author | dtrunov <dtrunov@luxoft.com> | 2016-07-13 11:47:46 +0300 |
---|---|---|
committer | dtrunov <dtrunov@luxoft.com> | 2016-07-13 12:19:09 +0300 |
commit | cf0ac46253ab8359ac3c5e770721bdf3f52040f5 (patch) | |
tree | fc43ac5f583721f7cb3eaf9ae01ba1c668567cfc /src/components/application_manager/src/hmi_language_handler.cc | |
parent | 5a157d170736e2c88d7cc1e2d284ff7f71496401 (diff) | |
download | sdl_core-cf0ac46253ab8359ac3c5e770721bdf3f52040f5.tar.gz |
Fix core crash during streaming and execution smoke test.
DCHECK appeared because application was unregestered during registration.
Fix problem with unregistration application in HMILanguageHandler.
Moved DCHECK from hmi_state because it posible if application might be unregistered during
processing application in state_ctrl. Added DCHECK for checking app_id when SLD adds hmi state to application.
Closes bug:[APPLINK-26397](https://adc.luxoft.com/jira/browse/APPLINK-26397)
Diffstat (limited to 'src/components/application_manager/src/hmi_language_handler.cc')
-rw-r--r-- | src/components/application_manager/src/hmi_language_handler.cc | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/components/application_manager/src/hmi_language_handler.cc b/src/components/application_manager/src/hmi_language_handler.cc index 72ab60eb3a..1bbb0f2051 100644 --- a/src/components/application_manager/src/hmi_language_handler.cc +++ b/src/components/application_manager/src/hmi_language_handler.cc @@ -131,8 +131,10 @@ void HMILanguageHandler::on_event(const event_engine::Event& event) { is_tts_language_received_ = true; break; case hmi_apis::FunctionID::BasicCommunication_OnAppRegistered: - CheckApplication( - std::make_pair(msg[strings::params][strings::app_id].asUInt(), true)); + if (msg[strings::params].keyExists(strings::app_id)) { + CheckApplication(std::make_pair( + msg[strings::params][strings::app_id].asUInt(), true)); + } return; default: return; @@ -288,11 +290,14 @@ void HMILanguageHandler::HandleWrongLanguageApp(const Apps::value_type& app) { << " is not found within apps with wrong language."); return; } + apps_.erase(it); + if (0 == apps_.size()) { + LOG4CXX_DEBUG(logger_, + "All apps processed. Unsubscribing from all events."); + unsubscribe_from_all_events(); + } - LOG4CXX_INFO(logger_, - "Unregistering application with app_id " - << app.first << " because of HMI language(s) mismatch."); - + sync_primitives::AutoUnlock un_lock(apps_lock_); SendOnLanguageChangeToMobile(app.first); application_manager_.ManageMobileCommand( MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( @@ -301,12 +306,9 @@ void HMILanguageHandler::HandleWrongLanguageApp(const Apps::value_type& app) { commands::Command::ORIGIN_SDL); application_manager_.UnregisterApplication( app.first, mobile_apis::Result::SUCCESS, false); - apps_.erase(it); - if (0 == apps_.size()) { - LOG4CXX_DEBUG(logger_, - "All apps processed. Unsubscribing from all events."); - unsubscribe_from_all_events(); - } + LOG4CXX_INFO(logger_, + "Unregistering application with app_id " + << app.first << " because of HMI language(s) mismatch."); } void HMILanguageHandler::CheckApplication(const Apps::value_type app) { @@ -332,4 +334,10 @@ void HMILanguageHandler::Init(resumption::LastState* value) { persisted_tts_language_ = get_language_for(INTERFACE_TTS); } +void HMILanguageHandler::OnUnregisterApplication(uint32_t app_id) { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock lock(apps_lock_); + apps_.erase(app_id); +} + } // namespace application_manager |