|
From: | Jonathan Kinsey |
Subject: | Re: [Bug-gnubg] Assertion fail with progress bar |
Date: | Fri, 9 Apr 2010 09:56:37 +0000 |
The best solution is to find out where the "worker" thread is calling ProgressEnd and change the code to stop this. Will be interesting to see what is happening. Doesn't hurt to add the code to avoid a divide by zero (in odd timing situations) either though. Jon On 09/04/2010 10:34, 保坂範行 wrote: >> Looks like ProgressEnd() is being called, probably in another thread. > I guess so too. > Only ProgressEnd changes iProgressMax. > > But I do not think >> gdouble frac = (iMax == 0) ? 1 : (double)iValue / iMax; > is one of right ways to fix it. > > I have not caught the thread yet, it is a right idea to keep another away > from calling ProgressEnd. > > Since we wait thread completion. gnubg.c:5500 > [code] > #if USE_MULTITHREAD > ret = MT_WaitForTasks(Progress, 100, FALSE); > #else > asyncRet = 0; > fn(data); /* Just call function in single threaded build */ > ret = asyncRet; > #endif > > ProgressEnd(); > > [end of code] > > > Nori > > 2010年4月9日17:18 Jonathan Kinsey : >> 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 >>> address@hidden >>> http://lists.gnu.org/mailman/listinfo/bug-gnubg >>> >>> >> >> >> >> >> ________________________________ >> Get a free e-mail account with Hotmail. Sign-up now. > > > _______________________________________________ > Bug-gnubg mailing list > address@hidden > http://lists.gnu.org/mailman/listinfo/bug-gnubg > > Get a free e-mail account with Hotmail. Sign-up now. |
[Prev in Thread] | Current Thread | [Next in Thread] |