X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fmain.cpp;fp=src%2Fmain.cpp;h=0447f86722d85214d9c78d96a3a74bd84766c881;hb=c1d85371b1eb693128cf9553c356ea77e609d9a3;hp=261df8b73e8f98cc47db06c9125c63423a0f746f;hpb=38255dcda8e7e9462ed3b16ebe39c638bc9b349f;p=apps%2Fagl-service-windowmanager-2017.git diff --git a/src/main.cpp b/src/main.cpp index 261df8b..0447f86 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -184,27 +184,19 @@ static void cbRemoveClientCtxt(void *data) return; } HMI_DEBUG("wm", "remove app %s", ctxt->name.c_str()); - // Lookup surfaceID and remove it because App is dead. - auto pSid = g_afb_instance->wmgr.id_alloc.lookup(ctxt->role.c_str()); - if (pSid) - { - auto sid = *pSid; - auto o_state = *g_afb_instance->wmgr.layers.get_layout_state(sid); - if (o_state != nullptr) - { - if (o_state->main == sid) - { - o_state->main = -1; - } - else if (o_state->sub == sid) + + // Policy Manager does not know this app was killed, + // so notify it by deactivate request. + g_afb_instance->wmgr.api_deactivate_surface( + ctxt->name.c_str(), ctxt->role.c_str(), + [](const char *errmsg) { + if (errmsg != nullptr) { - o_state->sub = -1; + HMI_ERROR("wm", errmsg); + return; } - } - g_afb_instance->wmgr.id_alloc.remove_id(sid); - g_afb_instance->wmgr.layers.remove_surface(sid); - HMI_DEBUG("wm", "delete surfaceID %d", sid); - } + }); + g_afb_instance->wmgr.removeClient(ctxt->name); delete ctxt; }