X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fmain.cpp;h=0447f86722d85214d9c78d96a3a74bd84766c881;hb=f0d9414627149fe5a2b055e7459619a4fff84da6;hp=b5659e27ab2b843cf9a20b13738c455453817229;hpb=3d1703f9a5c9d6a356b561ea7528c70a1dc4fe2d;p=apps%2Fagl-service-windowmanager.git diff --git a/src/main.cpp b/src/main.cpp index b5659e2..0447f86 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -184,29 +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); - g_afb_instance->wmgr.controller->sprops.erase(sid); - g_afb_instance->wmgr.controller->surfaces.erase(sid); - HMI_DEBUG("wm", "delete surfaceID %d", sid); - } + }); + g_afb_instance->wmgr.removeClient(ctxt->name); delete ctxt; }