Mercurial > MadButterfly
comparison src/animate.c @ 124:ad5ab8e61c2b
Free subject of complete when a program is freed
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Tue, 16 Sep 2008 14:55:24 +0800 |
parents | 9e2316dc6ecb |
children | 07dc9ec71221 |
comparison
equal
deleted
inserted
replaced
123:9e2316dc6ecb | 124:ad5ab8e61c2b |
---|---|
133 | 133 |
134 void mb_progm_free(mb_progm_t *progm) { | 134 void mb_progm_free(mb_progm_t *progm) { |
135 int n_words; | 135 int n_words; |
136 mb_word_t *word; | 136 mb_word_t *word; |
137 mb_action_t *cur_act; | 137 mb_action_t *cur_act; |
138 ob_factory_t *factory; | |
138 int i; | 139 int i; |
139 | 140 |
140 n_words = progm->n_words; | 141 n_words = progm->n_words; |
141 for(i = 0; i < n_words; i++) { | 142 for(i = 0; i < n_words; i++) { |
142 word = progm->words + i; | 143 word = progm->words + i; |
145 cur_act = STAILQ_HEAD(word->actions)) { | 146 cur_act = STAILQ_HEAD(word->actions)) { |
146 STAILQ_REMOVE(word->actions, mb_action_t, next, cur_act); | 147 STAILQ_REMOVE(word->actions, mb_action_t, next, cur_act); |
147 cur_act->free(cur_act); | 148 cur_act->free(cur_act); |
148 } | 149 } |
149 } | 150 } |
151 | |
152 factory = rdman_get_ob_factory(progm->rdman); | |
153 subject_free(factory, progm->complete); | |
154 | |
150 free(progm); | 155 free(progm); |
151 } | 156 } |
152 | 157 |
153 /*! \brief Add a new word into a program. | 158 /*! \brief Add a new word into a program. |
154 * | 159 * |