Revision 1214866

Go back to digest for 23rd January 2011

Bug Fixes in Games

Parker Coates committed changes in /trunk/KDE/kdegames/kpat/libkcardgame:

Fix a bug where painting caused near 100% CPU usage and mis-sized cards.

This one was a bit of a doozy. The route of the problem is KImageCache's
in memory pixmap cache was occasionally returning the wrong pixmap for
a given key. Why that was happening I still don't know. So a card would
go to paint itself and notice that its pixmap was the wrong size, so it
would ask for a new one. The KAbstractCardDeck would take the request,
notice that the requested image/size was in the cache and return the
cached version, but unfornuately this was actually the wrong pixmap and
had the wrong size. The card happily used this pixmap and painted itself
but the next time it went to paint it noticed that its pixmap was the
wrong size and the loop repeated, hence the high processor usage.

I've disabled the in memory pixmap cache as the benefit wasn't very
significant and I couldn't figure out what the issue actually was. There
were also some problems with the KCard and KAbstractCardDeck code that
made the problem worse than it should have been. Those have been fixed
as well.

File Changes

Modified 3 files
  • /trunk/KDE/kdegames/kpat/libkcardgame
  •   /common.cpp
  •   /kabstractcarddeck.cpp
  •   /kcard.cpp
3 files changed in total