signal forward: check for event reason after the event is processed 58/212358/3
authorMaciej Slodczyk <m.slodczyk2@partner.samsung.com>
Tue, 20 Aug 2019 06:44:36 +0000 (08:44 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 22 Aug 2019 14:51:48 +0000 (16:51 +0200)
Change-Id: I239f56ec3f4f90617da00215c214888c6b603217
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
src/action/action_executor.c
src/action/forward_signal.c

index a1695037c5be39a2df92b55d9200fca58d52a7cd..9d0a15e8dcb965be9d903bc801dc0c044ad0f15c 100644 (file)
@@ -114,8 +114,6 @@ static int action_executor_callback(sd_event_source *s, int fd,
        }
 
        exe_info = to_action_executed_event(ev);
-       dm_ev = to_decision_made_event(exe_info->reason);
-
        /*
         * If action is not fully executed after returning from this function
         * it takes the ownership of of exe_info and should report it when
@@ -134,7 +132,9 @@ static int action_executor_callback(sd_event_source *s, int fd,
                        goto cleanup;
                }
 
-               if (dm_ev->on_finished)
+               dm_ev = to_decision_made_event(exe_info->reason);
+
+               if (dm_ev && dm_ev->on_finished)
                        dm_ev->on_finished(dm_ev, exe_info->result);
        }
 
index 65a895d1c9036bd66f4c40b587516dd7f7308f2e..f38c77639ef4caf6a471fcf9efc3ebce42d2959c 100644 (file)
@@ -41,6 +41,7 @@ static int forward_signal(struct epc_action *action,
        //       form in module that generates the event, so might try to pass it here
        //       as epc_object (look for ->params in decision_makers/activation_dm)
        //FIXME: signal_params = NULL;
+       exe_info->reason = ev;
 
        epc_object_get_string(dm_ev->action_data, EPC_AD_SIGNAL_ACTION, &signal_action);
        epc_object_get_string(dm_ev->action_data, EPC_AD_SIGNAL_DEST, &signal_dest);
@@ -55,10 +56,6 @@ static int forward_signal(struct epc_action *action,
 
        dbus_handle_broadcast_dbus_signal(signal_dest, signal_path, signal_interface, signal_member, NULL);
 
-
-       //FIXME: shortly after this function exits actd gets segfault.  I assume something
-       //       more needs to be done in terms of cleanup here.  Unfortunatelly, I have
-       //       no idea what.
        exe_info->result = 0;
        return 0;