add exception handling code for abnormal app termination
[platform/framework/native/appwidget-service.git] / src / FShell_AppContext.cpp
index 779b43f..b1704ee 100644 (file)
@@ -233,6 +233,22 @@ _AppContext::OnIpcDisconnected(void)
 }
 
 void
+_AppContext::OnApplicationTerminated(void)
+{
+       if (GetWaitingStatus() == true )
+       {
+               SysLog(NID_SHELL, "The application (%ls) is terminated without response.", __appId.GetPointer() );
+               SetWaitingStatus(false);
+
+               if (GetConnectionState() == CONNECTION_STATE_CONNECTING)
+               {
+                       SysLog(NID_SHELL, "The application (%ls) is terminated before IPC connected, resetting connection state.", __appId.GetPointer() );
+                       SetConnectionState(CONNECTION_STATE_DISCONNECTED);
+               }
+       }
+}
+
+void
 _AppContext::SetWaitingStatus(bool status)
 {
        __isWaitingResult = status;