_InProcessInfo* pInfo = __inAppManager.FindItem(reqId);
SysTryReturnVoidResult(NID_APP, pInfo != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] request Id %d not found.", reqId);
+ // at least listener
IAppControlResponseListener* pListener = dynamic_cast<IAppControlResponseListener*>(pInfo->pListener);
- if (pListener == null)
- {
- SysLog(NID_APP, "Empty AppControl listener callback for req %d, app %ls.", reqId, appId.GetPointer());
- return;
- }
+ SysTryReturnVoidResult(NID_APP, pListener != null, E_SYSTEM, "[E_SYSTEM] Invalid result callback for req %d, app %ls.", reqId, appId.GetPointer());
result r = E_SUCCESS;
- AppId actualAppId = appId;
- if (appId == L'c')
+ if (pListener)
{
- actualAppId.Clear();
- r = E_OPERATION_CANCELED;
- }
- SysLog(NID_APP, "Invoking callback 0x%x.", pListener);
+ AppId actualAppId = appId;
+ if (appId == L'c')
+ {
+ actualAppId.Clear();
+ r = E_OPERATION_CANCELED;
+ }
+ SysLog(NID_APP, "Invoking callback 0x%x.", pListener);
- _AppControlResponseEvent* pResponseEvent = null;
- __appControlResponseEventContainer.GetValue(reqId, pResponseEvent);
- SysLog(NID_APP, "StartResponseReceived Request Id(%d), ResponseEvent 0x%x.", reqId, pResponseEvent);
- if (pResponseEvent != null)
- {
- String oId(operationId);
- _AppControlResponseEventArg* pResponseEventArg = new (std::nothrow) _AppControlResponseEventArg(pListener, _APPCONTROL_RESPONSETYPE_START, actualAppId, oId, r, APP_CTRL_RESULT_SUCCEEDED, null, reqId, false);
+ _AppControlResponseEvent* pResponseEvent = null;
+ __appControlResponseEventContainer.GetValue(reqId, pResponseEvent);
+ SysLog(NID_APP, "StartResponseReceived Request Id(%d), ResponseEvent 0x%x.", reqId, pResponseEvent);
+ if (pResponseEvent != null)
+ {
+ String oId(operationId);
+ _AppControlResponseEventArg* pResponseEventArg = new (std::nothrow) _AppControlResponseEventArg(pListener, _APPCONTROL_RESPONSETYPE_START, actualAppId, oId, r, APP_CTRL_RESULT_SUCCEEDED, null, reqId, false);
- if (pResponseEventArg != null)
+ if (pResponseEventArg != null)
+ {
+ pResponseEvent->Fire(*pResponseEventArg);
+ SysLog(NID_APP, "pResponseEvent is Fired");
+ }
+ }
+ else
{
- pResponseEvent->Fire(*pResponseEventArg);
- SysLog(NID_APP, "pResponseEvent is Fired");
+ pListener->OnAppControlStartResponseReceived(actualAppId, operationId, r);
+ SysLog(NID_APP, "OnAppControlStartResponseReceived called directly");
}
}
else
{
- pListener->OnAppControlStartResponseReceived(actualAppId, operationId, r);
- SysLog(NID_APP, "OnAppControlStartResponseReceived called directly");
+ SysLog(NID_APP, "No listener registered.");
}
if (r == E_OPERATION_CANCELED)
}
else
{
- SysLog(NID_APP, "Empty AppControl listener.");
+ SysLogException(NID_APP, E_SYSTEM, "Invalid AppControl listener.");
}
_InProcessInfo* pProcInfo = __inAppManager.FindItemWithListener(IsMatchingProcListener, pListener);
if (pProcInfo)
{
- pProcInfo->pListener = null;
+ __inAppManager.RemoveItem(pProcInfo);
SysLog(NID_APP, "Listener 0x%x is removed from in-process stub list.", pListener);
}
}