From: Marcus M. <cod...@gm...> - 2012-03-25 09:37:52
|
Hello Martin, thanks for your feedback and ideas. Till now I saw the bug located in the timer_group.c only. But due to the same problem in timer.c (later field elements might be changed in loop) I fear my patches might fail if the interval of a widget is changed. Both files will have to be patched similar to avoid the bug. > I have thought of adding a third state "on hold". New timers > should be set to "on hold" to make sure they are not processed in the > current loop. Now, each time "widget_timer_update()" is called, it > should change all timers from "on hold" to "active" so will get > processed from then on. Why shouldn't a new 'on hold' become 'active' in the same loop if 'widget_timer_update' is called multible times? And how would you guarantee that 'widget_timer_update' will ever be called again (to replace 'on hold' by 'active') if there is only one timer widget? Beside that I don't like the idea that third file functions which made use of timer.c & timer_group.c (might be many) have to make efforts to guarantee that they behave as exspected. But your basic idea might work. For timer_group.c (timer.c similar): You may replace 'widget' by a global (static) 'currentWidget' (initialized with -1 and set to -1 after the loop) in the process loop. In 'timer_add_widget' you set 'active' if (currentWidget<0 || widget<=currentWidget), else 'on hold'. If the process loop finds a 'on hold' it replaces it by 'active' and continues without processing this widget. If you've opened the files for changes already: I don't understand the realloc error handling in 'timer_add_widget' (similar in 'timer_add').In the case of a realloc error 'TimerGroupWidgets' was set to NULL. So there's no valid pointer to the existing TimerGroupWidgets after that. Won't that cause a memory leak and following errors cause nTimerGroupWidgets is only decreased by 1 instead of set it to 0? Shouldn't a additional pointer be used for the realloc return value to avoid this? Regards Marcus -- NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone! Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a |