Bug 204073

Summary: Klondike solver suggests illegal moves both in hints and in demo mode.
Product: [Applications] kpat Reporter: Evgenij Besogonov <bev>
Component: solverAssignee: Stephan Kulow <coolo>
Status: RESOLVED FIXED    
Severity: crash CC: adreeve, coates, emeraldsage, eugene.trounev, ivo, kde-games-bugs, montag.fire, mtijink.bugs, rvalkass
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Shows the illegal moves made by KPatience

Description Evgenij Besogonov 2009-08-16 20:37:31 UTC
Application that crashed: kpat
Version of the application: 3.2
KDE Version: 4.3.00 (KDE 4.3.0)
Qt Version: 4.5.2
Operating System: Linux 2.6.30.4-mainframe-20090816 x86_64
Distribution: Debian GNU/Linux 5.0.2 (lenny)

What I was doing when the application crashed:
I lose another game of "klondike", but solver says, that it can be won. So I've pressed the "Demonstation" button. KPat made some wrong moves and then crashes.

Sorry, bad English :(

 -- Backtrace:
Application: Пасьянс KDE (kpat), signal: Segmentation fault
[KCrash Handler]
#5  0x0000000000428ba0 in DealerScene::demo (this=0x29b8f30) at /build/buildd/kdegames-4.3.0/kpat/dealer.cpp:1694
#6  0x000000000042a6a5 in DealerScene::qt_metacall (this=0x29b8f30, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fffd7c01160)
    at /build/buildd/kdegames-4.3.0/obj-x86_64-linux-gnu/kpat/dealer.moc:155
#7  0x00000000004419c5 in Klondike::qt_metacall (this=0x7fffd7c01010, _c=3263904712, _id=41145840, _a=0x0) at /build/buildd/kdegames-4.3.0/obj-x86_64-linux-gnu/kpat/klondike.moc:62
#8  0x00007fadc4571602 in QMetaObject::activate (sender=0x2d5ba60, from_signal_index=<value optimized out>, to_signal_index=4, argv=0x0) at kernel/qobject.cpp:3112
#9  0x00007fadc456bb73 in QObject::event (this=0x2d5ba60, e=0x7fadc28b3bc8) at kernel/qobject.cpp:1074
#10 0x00007fadc346c7ad in QApplicationPrivate::notify_helper (this=0x1ff2e40, receiver=0x2d5ba60, e=0x7fffd7c01810) at kernel/qapplication.cpp:4056
#11 0x00007fadc347480a in QApplication::notify (this=0x7fffd7c01c70, receiver=0x2d5ba60, e=0x7fffd7c01810) at kernel/qapplication.cpp:4021
#12 0x00007fadc53c5b2b in KApplication::notify (this=0x7fffd7c01c70, receiver=0x2d5ba60, event=0x7fffd7c01810) at ../../kdeui/kernel/kapplication.cpp:302
#13 0x00007fadc455c49c in QCoreApplication::notifyInternal (this=0x7fffd7c01c70, receiver=0x2d5ba60, event=0x7fffd7c01810) at kernel/qcoreapplication.cpp:610
#14 0x00007fadc45887a6 in QCoreApplication::sendEvent (this=0x1ff6aa0) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:213
#15 QTimerInfoList::activateTimers (this=0x1ff6aa0) at kernel/qeventdispatcher_unix.cpp:572
#16 0x00007fadc4584c1d in timerSourceDispatch (source=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:165
#17 0x00007fadbfa347aa in g_main_dispatch (context=0x1ff5920) at /tmp/buildd/glib2.0-2.20.4/glib/gmain.c:1824
#18 IA__g_main_context_dispatch (context=0x1ff5920) at /tmp/buildd/glib2.0-2.20.4/glib/gmain.c:2377
#19 0x00007fadbfa37df8 in g_main_context_iterate (context=0x1ff5920, block=1, dispatch=1, self=<value optimized out>) at /tmp/buildd/glib2.0-2.20.4/glib/gmain.c:2455
#20 0x00007fadbfa37fac in IA__g_main_context_iteration (context=0x1ff5920, may_block=1) at /tmp/buildd/glib2.0-2.20.4/glib/gmain.c:2518
#21 0x00007fadc4584b7f in QEventDispatcherGlib::processEvents (this=0x1fab5c0, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:327
#22 0x00007fadc35035ef in QGuiEventDispatcherGlib::processEvents (this=0x7fffd7c01010, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:202
#23 0x00007fadc455ad62 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#24 0x00007fadc455b134 in QEventLoop::exec (this=0x7fffd7c01ac0, flags=...) at kernel/qeventloop.cpp:201
#25 0x00007fadc455d3a4 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:888
#26 0x0000000000416612 in main (argc=3, argv=0x7fffd7c025e8) at /build/buildd/kdegames-4.3.0/kpat/main.cpp:267

This bug may be a duplicate of or related to bug 194943

Reported using DrKonqi
Comment 1 Evgenij Besogonov 2009-08-16 20:44:59 UTC
Yep, I can reproduce it.

Here is another backtrace, it seems a bit differ. My actions before the crash were the same.

Application: Пасьянс KDE (kpat), signal: Segmentation fault
[KCrash Handler]
#5  0x000000000044058c in KlondikeSolver::translateMove (this=0x271b2a0, m=...) at /build/buildd/kdegames-4.3.0/kpat/patsolve/klondike.cpp:545
#6  0x00000000004278f1 in DealerScene::chooseHint (this=0x26e2dc0) at /build/buildd/kdegames-4.3.0/kpat/dealer.cpp:1659
#7  0x0000000000428b77 in DealerScene::demo (this=0x26e2dc0) at /build/buildd/kdegames-4.3.0/kpat/dealer.cpp:1692
#8  0x000000000042a6a5 in DealerScene::qt_metacall (this=0x26e2dc0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff838675a0)
    at /build/buildd/kdegames-4.3.0/obj-x86_64-linux-gnu/kpat/dealer.moc:155
#9  0x00000000004419c5 in Klondike::qt_metacall (this=0x2718660, _c=4294967295, _id=42211168, _a=0x26e9e80) at /build/buildd/kdegames-4.3.0/obj-x86_64-linux-gnu/kpat/klondike.moc:62
#10 0x00007f97b28fa602 in QMetaObject::activate (sender=0x26edd40, from_signal_index=<value optimized out>, to_signal_index=4, argv=0x26e9e80) at kernel/qobject.cpp:3112
#11 0x00007f97b28f4b73 in QObject::event (this=0x26edd40, e=0xffffffff) at kernel/qobject.cpp:1074
#12 0x00007f97b17f57ad in QApplicationPrivate::notify_helper (this=0x2432fe0, receiver=0x26edd40, e=0x7fff83867c50) at kernel/qapplication.cpp:4056
#13 0x00007f97b17fd80a in QApplication::notify (this=0x7fff838680b0, receiver=0x26edd40, e=0x7fff83867c50) at kernel/qapplication.cpp:4021
#14 0x00007f97b374eb2b in KApplication::notify (this=0x7fff838680b0, receiver=0x26edd40, event=0x7fff83867c50) at ../../kdeui/kernel/kapplication.cpp:302
#15 0x00007f97b28e549c in QCoreApplication::notifyInternal (this=0x7fff838680b0, receiver=0x26edd40, event=0x7fff83867c50) at kernel/qcoreapplication.cpp:610
#16 0x00007f97b29117a6 in QCoreApplication::sendEvent (this=0x2436c40) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:213
#17 QTimerInfoList::activateTimers (this=0x2436c40) at kernel/qeventdispatcher_unix.cpp:572
#18 0x00007f97b290dc1d in timerSourceDispatch (source=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:165
#19 0x00007f97addbd7aa in g_main_dispatch (context=0x2435920) at /tmp/buildd/glib2.0-2.20.4/glib/gmain.c:1824
#20 IA__g_main_context_dispatch (context=0x2435920) at /tmp/buildd/glib2.0-2.20.4/glib/gmain.c:2377
#21 0x00007f97addc0df8 in g_main_context_iterate (context=0x2435920, block=1, dispatch=1, self=<value optimized out>) at /tmp/buildd/glib2.0-2.20.4/glib/gmain.c:2455
#22 0x00007f97addc0fac in IA__g_main_context_iteration (context=0x2435920, may_block=1) at /tmp/buildd/glib2.0-2.20.4/glib/gmain.c:2518
#23 0x00007f97b290db7f in QEventDispatcherGlib::processEvents (this=0x23ea5c0, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:327
#24 0x00007f97b188c5ef in QGuiEventDispatcherGlib::processEvents (this=0x2718660, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:202
#25 0x00007f97b28e3d62 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#26 0x00007f97b28e4134 in QEventLoop::exec (this=0x7fff83867f00, flags=...) at kernel/qeventloop.cpp:201
#27 0x00007f97b28e63a4 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:888
#28 0x0000000000416612 in main (argc=1, argv=0x7fff83868a28) at /build/buildd/kdegames-4.3.0/kpat/main.cpp:267
Comment 2 Stephan Kulow 2009-08-18 10:50:11 UTC
I need a save game
Comment 3 Dario Andres 2009-09-03 01:44:48 UTC
*** Bug 206032 has been marked as a duplicate of this bug. ***
Comment 4 Evgenij Besogonov 2009-09-07 15:49:04 UTC
Can't reproduce this bug after reboot :(
Seems like it exist under very specific surcumstances only.
Next time I'll make a save.
Comment 5 Matthijs 2009-09-07 17:08:27 UTC
I found the way to reproduce this bug:

Select draw-1 in Klondike. Then choose draw-3.
When you start the demo (immediately or after playing yourself first) after a while kpatience starts making illegal moves and then crashes.

If you use a savegame, the game mode isn't loaded correctly, because it loads with draw-1, even though the game is played with draw-3. Also KPatience doesn't crash when the savegame is used.
Comment 6 Matthijs 2009-09-07 17:09:59 UTC
Created attachment 36773 [details]
Shows the illegal moves made by KPatience

This savegame can't be used to reproduce the bug
Comment 7 Parker Coates 2009-09-08 04:44:58 UTC
Matthijs, which version of KPat are you running? The issue with KPat not remembering the "draw number" when loading a save game should be fixed in KPat 3.2 (KDE4.3). If that's not the case, please open a new bug report.

I can't reproduce with the exact steps described above. I was able to cause a crash, by playing around with the draw number and the demo. No sign of bad moves yet, though. I'll look into it further.
Comment 8 Matthijs 2009-09-08 15:45:01 UTC
I run 3.2. Somehow KPatience does correctly load my savefile now. So I can't reproduce that.
Comment 9 Parker Coates 2009-09-09 03:56:48 UTC
*** Bug 190466 has been marked as a duplicate of this bug. ***
Comment 10 Parker Coates 2009-09-09 04:01:11 UTC
The problem indeed seems to be that solver is suggesting illegal moves. On debug builds this triggers an assert. On release builds it just silently breaks. I added some extra debug output to my local copy and ended up getting results like:

kpat(22547) DealerScene::demo: Moving "4OfClubs" from "pile" to "play5" on top of "11OfClubs"

Now to figure out why.
Comment 11 Parker Coates 2010-01-06 16:32:03 UTC
*** Bug 208693 has been marked as a duplicate of this bug. ***
Comment 12 Parker Coates 2010-01-16 20:39:29 UTC
SVN commit 1075788 by coates:

Fix bug where Klondike solver/demo was making illegal moves.

The solver wasn't being notified/replaced when the draw number was being
changed. Patch based on a suggestion by Julian Helfferich.

BUG:204073
CCMAIL:julian.helfferich@googlemail.com

 M  +12 -6     klondike.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1075788
Comment 13 Parker Coates 2010-01-16 20:53:06 UTC
SVN commit 1075794 by coates:

Backport of revision 1075788.

Fix bug where Klondike solver/demo was making illegal moves.

The solver wasn't being notified/replaced when the draw number was being
changed. Patch based on a suggestion by Julian Helfferich.

CCBUG:204073
CCMAIL:julian.helfferich@googlemail.com


 M  +18 -11    klondike.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1075794
Comment 14 Parker Coates 2010-03-01 00:07:05 UTC
*** Bug 228975 has been marked as a duplicate of this bug. ***
Comment 15 Parker Coates 2010-03-17 02:23:55 UTC
*** Bug 231051 has been marked as a duplicate of this bug. ***