[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdegames/kpat/patsolve
From: Parker Coates <parker.coates () gmail ! com>
Date: 2009-05-13 18:25:53
Message-ID: 1242239153.846575.1285.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 967673 by coates:
Fixed a Q_ASSERT based crashed in the Grandfather's Clock solver.
The translate_layout() method asserted that each of the 12 target piles always \
contain at least one pile. Unfortunately, if it takes an especially long time to \
render the card graphics at the start of a new game the 250ms solver restart timer \
can time out and this method can be called before the intitial deal has even \
happened.
The proper fix would be to ensure that the solver is never started before the cards \
have actually been dealt, but I saw no way of cleanly implementing that.
M +6 -2 clock.cpp
--- trunk/KDE/kdegames/kpat/patsolve/clock.cpp #967672:967673
@@ -258,9 +258,13 @@
for (int i = 0; i < 12; i++)
{
Card *c = deal->target[i]->top();
- Q_ASSERT( c );
- W[8][i] = translateSuit( c->suit() ) + c->rank();
+ // It is not safe to assume that each target pile will always have a
+ // card on it. If it takes particularly long to render the card graphics
+ // at the start of a new game, it is possible that this method can be
+ // called before the initial deal has been completed.
+ if (c)
+ W[8][i] = translateSuit( c->suit() ) + c->rank();
}
Wp[8] = &W[8][11];
Wlen[8] = 12;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic