Looks like ProgressEnd() is being called, probably in another thread.  Changing
GtkProgressValue to have something like:

    gdouble frac = (iMax == 0) ? 1 : (double)iValue / iMax;

Jon

On 09/04/2010 06:46, 保坂範行 wrote:
> Hi.
> 
> I see assertion fail when analysis of game/match done.
> Such as
> (gnubg:30806): Gtk-CRITICAL **: gtk_progress_set_percentage: assertion
> `percentage>= 0 && percentage <= 1.0' failed
> 
> 
> To find out, I inserted old printf as follow:
> 
> gtkgame.c
> extern void GTKProgressValue ( int iValue, int iMax )
> {
>     gchar *gsz;
>     gdouble frac = 1.0 * iValue / (1.0 * iMax );
>     gsz = g_strdup_printf("%d/%d (%.0f%%)", iValue, iMax, 100 * frac);
>     gtk_progress_bar_set_text( GTK_PROGRESS_BAR( pwProgress ), gsz);
>     printf("%d, %d, %f\n", iValue, iMax, frac);
>     gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR( pwProgress ), frac);
>     g_free(gsz);
> 
>         ProcessEvents();
> }
> 
> 
> And got:
> 
> (Game over) analyse match
> 1, 61, 0.016393
> 3, 61, 0.049180
> 6, 61, 0.098361
> 9, 61, 0.147541
> 12, 61, 0.196721
> 15, 61, 0.245902
> 19, 61, 0.311475
> 28, 61, 0.459016
> 43, 61, 0.704918
> 47, 61, 0.770492
> 49, 61, 0.803279
> 51, 61, 0.836066
> 53, 61, 0.868852
> 55, 61, 0.901639
> 57, 61, 0.934426
> 60, 0, inf
> (gnubg:30806): Gtk-CRITICAL **: gtk_progress_set_percentage: assertion
> `percentage>= 0 && percentage <= 1.0' failed
> 
> 
> This means GTKProgressValue got iMax =0.
> 
> By using ddd/gdb, I found that it happend via
> 
> static gboolean UpdateProgressBar(gpointer unused)
> {
>         ProgressValue(MT_GetDoneTasks());
>         return TRUE;
> }
> 
> Some how iMax in ProgressValue has changed to 0.
> 
> 
> Nori
> 
> 
> _______________________________________________
> Bug-gnubg mailing list
> Bug-gnubg@gnu.org
> http://lists.gnu.org/mailman/listinfo/bug-gnubg
> 
> 



                                          
_________________________________________________________________
http://clk.atdmt.com/UKM/go/195013117/direct/01/
_______________________________________________
Bug-gnubg mailing list
Bug-gnubg@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnubg

Reply via email to