hs-clientmanager: Do not store always the client context
[apps/agl-service-homescreen.git] / src / hs-clientmanager.cpp
index 7c2adc5..e880c62 100644 (file)
@@ -94,9 +94,10 @@ HS_ClientCtxt* HS_ClientManager::createClientCtxt(afb_req_t req, std::string app
         ctxt = new HS_ClientCtxt(appid);
         afb_req_session_set_LOA(req, 1);
         afb_req_context_set(req, ctxt, cbRemoveClientCtxt);
+
+       appid2ctxt[appid] = ctxt;
     }
 
-    appid2ctxt[appid] = ctxt;
     return ctxt;
 }
 
@@ -184,6 +185,7 @@ int HS_ClientManager::handleRequest(afb_req_t request, const char *verb, const c
         std::string id(appid);
         auto ip = client_list.find(id);
         if(ip != client_list.end()) {
+           // FIXME: do another verification here in case the application died
             ret = ip->second->handleRequest(request, verb);
         }
         else {