+void WindowManager::onApplicationTerminated(const WMClientCtxt& ctxt)
+{
+ if(!g_app_list.contains(ctxt.name))
+ {
+ return;
+ }
+ auto client = g_app_list.lookUpClient(ctxt.name);
+ unsigned sid = client->surfaceID(ctxt.role);
+ if (sid != 0)
+ {
+ // update state
+ auto o_state = *this->layers.get_layout_state(sid);
+ if (o_state != nullptr)
+ {
+ if (o_state->main == sid)
+ {
+ o_state->main = -1;
+ }
+ else if (o_state->sub == sid)
+ {
+ o_state->sub = -1;
+ }
+ }
+ this->id_alloc.remove_id(sid);
+ this->layers.remove_surface(sid);
+ HMI_DEBUG("wm", "delete surfaceID %d", sid);
+ }
+ g_app_list.removeClient(ctxt.name);
+}
+