Harald Welte has submitted this change and it was merged.

Change subject: fsm: do not terminate child FSMs early
......................................................................


fsm: do not terminate child FSMs early

The function _osmo_fsm_inst_term() terminates all child FSMs befor
it calls fi->fsm_cleanup(). This prevnts the cleanup callback to
perform last actions on the child FSMs (e.g.
osmo_fsm_inst_unlink_parent()).

move the function call to  _osmo_fsm_inst_term_children() below the
call to fi->fsm->cleanup().

Change-Id: Ie89d435417306c6bf897274eabc3ed0a46485c26
---
M src/fsm.c
1 file changed, 4 insertions(+), 3 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved; Verified



diff --git a/src/fsm.c b/src/fsm.c
index d8751c9..dd3538f 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -509,9 +509,6 @@
        LOGPFSMSRC(fi, file, line, "Terminating (cause = %s)\n",
                   osmo_fsm_term_cause_name(cause));
 
-       _osmo_fsm_inst_term_children(fi, OSMO_FSM_TERM_PARENT, NULL,
-                                    file, line);
-
        /* delete ourselves from the parent */
        parent = fi->proc.parent;
        if (parent) {
@@ -524,6 +521,10 @@
        if (fi->fsm->cleanup)
                fi->fsm->cleanup(fi, cause);
 
+       /* terminate all children */
+       _osmo_fsm_inst_term_children(fi, OSMO_FSM_TERM_PARENT, NULL,
+                                    file, line);
+       
        LOGPFSMSRC(fi, file, line, "Freeing instance\n");
        /* Fetch parent again in case it has changed. */
        parent = fi->proc.parent;

-- 
To view, visit https://gerrit.osmocom.org/6318
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie89d435417306c6bf897274eabc3ed0a46485c26
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: dexter <pma...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pma...@sysmocom.de>

Reply via email to