From: <no...@tc...> - 2025-03-06 03:17:15
|
Automated mail by fx, on behalf of no...@tc... Ticket Change [f2d16bb6bff94028cc879badd0f3141bcb26ad25d3cd18d39fef9ce53872c14c] [Error in computing return value of AnimationEnabled for ttk progress bar] By marc_culler For Tk On 2025-03-06T03:09:54.242 Details https://core.tcl-lang.org/tk/tinfo?name=f2d16bb6bff94028cc879badd0f3141bcb26ad25d3cd18d39fef9ce53872c14c Ticket https://core.tcl-lang.org/tk/tktview/ef1bfef57e05099e93f1eb0960e658def076e424 Changed Fields assignee: nobody closer: nobody comment: I noticed an amazing bug in the implementation of the ttk progress bar when I was looking into [7e28ef577a]. When the loop incrementing the progress bar reached the end, the progress bar was rapidly redisplayed even though nothing was changing. (The value at the end of the loop was 99.) It turned out that AnimationEnabled was returning 1 even though the progress bar was determinate. The cause was a misplaced parenthesis dating back to 2006. The effect is to make any determinate progress bar be animated almost all of the time. This may explain, at least partly, the reports that progress bars significantly increase CPU usage even when they are not doing anything. Here is the problematic code: ``` return pb->progress.period > 0 && value > 0.0 && ( value < maximum || pb->progress.mode == TTK_PROGRESSBAR_INDETERMINATE); ``` The correct code (with extra parentheses for clarity) would be: ``` return (pb->progress.period > 0 && value > 0.0 && value < maximum) || (pb->progress.mode == TTK_PROGRESSBAR_INDETERMINATE); ``` foundin: 9.0.1 is_private: 0 login: marc_culler priority: 5 Medium private_contact: 4a267845b96d18ced148980dad8c23b791785018 resolution: None severity: Important status: Open submitter: marc_culler subsystem: 88. Themed Tk title: Error in computing return value of AnimationEnabled for ttk progress bar type: Bug ------------------------------------------------------------ See Tcl/Tk development @ http://core.tcl-lang.org/ ------------------------------------------------------------ |