changeset 335:01038b8d8f05

Set the progm to be NULL so that we won't call mb_progm_abort when we call it at the next time. This will fix the crash issue of the dynamic. However, the dynamic is still crash sometimes if we click the button quickly. It looks like it crashes in the refresh. We need to future figure out the issue.
author wycc
date Sat, 07 Mar 2009 14:24:55 +0800
parents f90c60967a9c
children 995eb2c1a1aa
files src/mbaf/mbbutton.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/mbaf/mbbutton.c	Sat Mar 07 08:33:01 2009 +0800
+++ b/src/mbaf/mbbutton.c	Sat Mar 07 14:24:55 2009 +0800
@@ -56,6 +56,14 @@
     mb_button_refresh(btn);
 }
 
+static void mb_button_end_animated_cb(event_t *evt, void *arg)
+{
+    mb_button_t *btn = (mb_button_t *) arg;
+
+    btn->progm = NULL;
+    
+}
+
 static void mb_button_pressed(event_t *evt, void *arg)
 {
     mb_button_t *btn = (mb_button_t *) arg;
@@ -80,6 +88,7 @@
     mb_visibility_new(VIS_HIDDEN, btn->click, word);
     mb_visibility_new(VIS_VISIBLE, btn->active, word);
     mb_progm_free_completed(progm);
+    subject_add_observer(mb_progm_get_complete(btn->progm), mb_button_end_animated_cb,btn);
     get_now(&now);
     printf("rt = %x\n", btn->rdman->rt);
     mb_progm_start(progm, X_MB_tman(btn->rdman->rt), &now);