comparison src/subtree_free.c @ 194:45d9a1e2764d

Add mb_subtree_free animate action and fix bugs. - Free members of a coord in rdman_coord_subtree_free(). - Fix core dump issue of subject_notify() that can not free subjects well.
author Thinker K.F. Li <thinker@branda.to>
date Wed, 19 Nov 2008 20:53:40 +0800
parents
children 586e50f82c1f
comparison
equal deleted inserted replaced
193:923d91dfb6af 194:45d9a1e2764d
1 #include "mb_redraw_man.h"
2 #include "mb_animate.h"
3
4 struct _subtree_free {
5 mb_action_t action;
6
7 coord_t *coord;
8 };
9
10 typedef struct _subtree_free subtree_free_t;
11
12 void mb_subtree_free_start(mb_action_t *action,
13 const mb_timeval_t *now,
14 const mb_timeval_t *playing_time,
15 redraw_man_t *rdman) {
16 subtree_free_t *sfree = (subtree_free_t *)action;
17
18 rdman_coord_subtree_free(rdman, sfree->coord);
19 }
20
21 void mb_subtree_free_step(mb_action_t *act, const mb_timeval_t *now,
22 redraw_man_t *rdman) {
23 }
24
25 void mb_subtree_free_stop(mb_action_t *act, const mb_timeval_t *now,
26 redraw_man_t *rdman) {
27 }
28
29 void mb_subtree_free_free(mb_action_t *act) {
30 free(act);
31 }
32
33 mb_action_t *mb_subtree_free_new(coord_t *coord,
34 mb_word_t *word) {
35 subtree_free_t *sfree;
36
37 sfree = (subtree_free_t *)malloc(sizeof(subtree_free_t));
38 if(sfree == NULL)
39 return NULL;
40
41 sfree->action.start = mb_subtree_free_start;
42 sfree->action.step = mb_subtree_free_step;
43 sfree->action.stop = mb_subtree_free_stop;
44 sfree->action.free = mb_subtree_free_free;
45 sfree->coord = coord;
46
47 mb_word_add_action(word, (mb_action_t *)sfree);
48
49 return (mb_action_t *)sfree;
50 }