diff options
author | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-08-30 14:30:16 +0900 |
---|---|---|
committer | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-08-31 13:01:50 +0900 |
commit | e65b048f311335ee550ac51f97f8ce50468babf9 (patch) | |
tree | 3c94b6ded098f73e1153afcd7ad43ff2732b143b | |
parent | 1859dd4135f5d019f16a1333df318ecd1211afb9 (diff) |
Fix Window Manager crush when application terminated
Fix Window Manager crush when applicaiton terminated
caused by wrong handling of sd_event_source.
v2. Add error check just in case
Bug-AGL: SPEC-1696
Change-Id: I639a60015cde46fca6bc5a3f6e8037afd8d79330
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r-- | policy_manager/policy_manager.cpp | 21 | ||||
-rw-r--r-- | src/window_manager.cpp | 4 |
2 files changed, 12 insertions, 13 deletions
diff --git a/policy_manager/policy_manager.cpp b/policy_manager/policy_manager.cpp index a482e0c..c7bb007 100644 --- a/policy_manager/policy_manager.cpp +++ b/policy_manager/policy_manager.cpp @@ -688,19 +688,16 @@ int PolicyManager::timerEvent(sd_event_source *source, uint64_t usec, void *data int PolicyManager::setStateTransitionProcessToSystemd(int event_id, uint64_t delay_ms, std::string role) { + struct sd_event_source *event_source; HMI_DEBUG("wm:pm", "event_id:0x%x delay:%d role:%s", event_id, delay_ms, role.c_str()); - // Store requested role - this->req_role_list[event_id] = role; - if (0 == delay_ms) { - int ret = sd_event_add_defer(afb_daemon_get_event_loop(), NULL, + int ret = sd_event_add_defer(afb_daemon_get_event_loop(), &event_source, &pm::transitionStateWrapper, new int(event_id)); if (0 > ret) { HMI_ERROR("wm:pm", "Faild to sd_event_add_defer: errno:%d", ret); - this->req_role_list.erase(event_id); return -1; } } @@ -708,27 +705,25 @@ int PolicyManager::setStateTransitionProcessToSystemd(int event_id, uint64_t del { // Get current time struct timespec time_spec; - clock_gettime(CLOCK_MONOTONIC, &time_spec); + clock_gettime(CLOCK_BOOTTIME, &time_spec); // Calculate timer fired time uint64_t usec = (time_spec.tv_sec * 1000000) + (time_spec.tv_nsec / 1000) + (delay_ms * 1000); // Set timer - struct sd_event_source *event_source; int ret = sd_event_add_time(afb_daemon_get_event_loop(), &event_source, - CLOCK_MONOTONIC, usec, 1, + CLOCK_BOOTTIME, usec, 1, &pm::timerEventWrapper, new int(event_id)); if (0 > ret) { HMI_ERROR("wm:pm", "Faild to sd_event_add_time: errno:%d", ret); - this->req_role_list.erase(event_id); return -1; } - - // Store event source - this->event_source_list[event_id] = event_source; } - + // Store event source + this->event_source_list[event_id] = event_source; + // Store requested role + this->req_role_list[event_id] = role; return 0; } diff --git a/src/window_manager.cpp b/src/window_manager.cpp index 24b6f30..42930dc 100644 --- a/src/window_manager.cpp +++ b/src/window_manager.cpp @@ -657,6 +657,10 @@ void WindowManager::startTransitionWrapper(std::vector<WMAction> &actions) { bool found; auto const &surface_id = this->lookup_id(act.role.c_str()); + if(surface_id == nullopt) + { + goto proc_remove_request; + } std::string appid = g_app_list.getAppID(*surface_id, act.role, &found); if (!found) { |