Bugfix: Occur segmentation fault when steping on the accelerator before navi app...
authorYuta Doi <yuta-d@witz-inc.co.jp>
Wed, 23 May 2018 04:34:13 +0000 (13:34 +0900)
committerYuta Doi <yuta-d@witz-inc.co.jp>
Wed, 23 May 2018 05:07:42 +0000 (14:07 +0900)
Change-Id: I5d1218c5eee9001725c14e7f20d05466b073bcfb
Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
src/policy_manager/zipc/dummy_stm.c

index fc92c3e..2e31712 100644 (file)
@@ -126,6 +126,7 @@ stm_state_t g_crr_state;
 stm_state_t g_prv_state;
 int g_prv_restriction_state_car_stop = 0;
 int g_prv_apps_state_car_stop = 0;
+int g_map_is_activated = STM_FALSE;
 
 void stmInitialize() {
     // Initialize previous state
@@ -271,8 +272,10 @@ int stmTransitionState(int event, stm_state_t* state) {
 
                 // Update apps layer
                 g_prv_apps_state_car_stop = apps_state;
-                g_crr_state.layer.apps.state = gStmLayoutNoM1;
-                g_crr_state.layer.apps.is_changed = STM_TRUE;
+                if (STM_TRUE == g_map_is_activated) {
+                    g_crr_state.layer.apps.state = gStmLayoutNoM1;
+                    g_crr_state.layer.apps.is_changed = STM_TRUE;
+                }
             }
         }
         else {
@@ -286,8 +289,10 @@ int stmTransitionState(int event, stm_state_t* state) {
                 g_crr_state.layer.restriction.is_changed = STM_TRUE;
 
                 // Update apps layer
-                g_crr_state.layer.apps.state = g_prv_apps_state_car_stop;
-                g_crr_state.layer.apps.is_changed = STM_TRUE;
+                if (STM_TRUE == g_map_is_activated) {
+                    g_crr_state.layer.apps.state = g_prv_apps_state_car_stop;
+                    g_crr_state.layer.apps.is_changed = STM_TRUE;
+                }
             }
         }
     }
@@ -538,5 +543,13 @@ int stmTransitionState(int event, stm_state_t* state) {
     // Copy current state for return
     memcpy(state, &g_crr_state, sizeof(g_crr_state));
 
+    if ((STM_FALSE == g_map_is_activated)
+        && (STM_TRUE == g_crr_state.layer.apps.is_changed)
+        && ((gStmLayoutNoM1 == g_crr_state.layer.apps.state)
+            || (gStmLayoutNoM2 == g_crr_state.layer.apps.state)
+            || (gStmLayoutNoMf == g_crr_state.layer.apps.state))) {
+        g_map_is_activated = STM_TRUE;
+    }
+
     return 0;
 }