Bug 436181 - kpat crashes when right-click an ace card to send it upper right position.
Summary: kpat crashes when right-click an ace card to send it upper right position.
Status: RESOLVED FIXED
Alias: None
Product: kpat
Classification: Applications
Component: general (show other bugs)
Version: 21.04.0
Platform: Slackware Linux
: NOR crash
Target Milestone: ---
Assignee: Stephan Kulow
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-25 18:31 UTC by Paulo
Modified: 2021-05-05 02:11 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paulo 2021-04-25 18:31:49 UTC
SUMMARY
kpat crashes when right-click an ace card to send it upper right position.
I think this happens since the addition of Baker's Dozen and the Freecell variants.
It happens on Xfce and KDE Plasma5, so it seems Desktop Environment independent.
I never saw this crash before in any kpat game.

STEPS TO REPRODUCE
1. Click on a new game Freecell.

2. If it starts as Forecell (or Freecell), change it to Freecell (or Forecell, or any other variant)
in 'Settings -> Popular Variants Presets -> FreeCell (or Forecell, or any other variant)'.

3. On the first free ace available, right-click on it to send it to the upper right position.
kpat will crash. Dragging it with left-button and dropping it is ok.


OBSERVED RESULT
kpat crashes.

EXPECTED RESULT
Right-click on ace card should auto-move it to one of the upper right positions.


ADDITIONAL INFORMATION
Following is the crash report:


Application: kpat (21.4.0)

Qt Version: 5.15.2
Frameworks Version: 5.81.0
Operating System: Linux 5.10.32 x86_64
Windowing System: X11
Drkonqi Version: 5.21.4
Distribution: Slackware 14.2 x86_64 (post 14.2 -current)

-- Information about the crash:
<In detail, tell us what you were doing  when the application crashed.>

The crash can be reproduced every time.

-- Backtrace:
Application: KPatience (kpat), signal: Segmentation fault

[KCrash Handler]
#4  0x00007f0139f63b6e in QGraphicsScene::addItem(QGraphicsItem*) () from /usr/lib64/libQt5Widgets.so.5
#5  0x00007f013b5f6973 in KCardPile::insert(int, KCard*) () from /usr/lib64/libkcardgame.so
#6  0x00007f013b5f9ba4 in ?? () from /usr/lib64/libkcardgame.so
#7  0x00007f013b5fa80a in KCardScene::moveCardsToPile(QList<KCard*> const&, KCardPile*, int) () from /usr/lib64/libkcardgame.so
#8  0x00007f013b5fc006 in KCardScene::moveCardToPile(KCard*, KCardPile*, int) () from /usr/lib64/libkcardgame.so
#9  0x0000000000427bbc in ?? ()
#10 0x0000000000464b69 in ?? ()
#11 0x00007f013914eaf4 in ?? () from /usr/lib64/libQt5Core.so.5
#12 0x00007f013b5eed52 in KCardScene::cardRightClicked(KCard*) () from /usr/lib64/libkcardgame.so
#13 0x00007f013b5fcabd in KCardScene::mouseReleaseEvent(QGraphicsSceneMouseEvent*) () from /usr/lib64/libkcardgame.so
#14 0x000000000042afcf in ?? ()
#15 0x00007f0139f6ec62 in QGraphicsScene::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#16 0x00007f0139c50a8f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#17 0x00007f013911a19a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#18 0x00007f0139f8b330 in QGraphicsView::mouseReleaseEvent(QMouseEvent*) () from /usr/lib64/libQt5Widgets.so.5
#19 0x00007f0139c8f5ce in QWidget::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#20 0x00007f0139d3897e in QFrame::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#21 0x00007f0139119f1b in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#22 0x00007f0139c50a7e in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#23 0x00007f0139c57a09 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#24 0x00007f013911a19a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#25 0x00007f0139c56af0 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () from /usr/lib64/libQt5Widgets.so.5
#26 0x00007f0139ca7f58 in ?? () from /usr/lib64/libQt5Widgets.so.5
#27 0x00007f0139caaf75 in ?? () from /usr/lib64/libQt5Widgets.so.5
#28 0x00007f0139c50a8f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#29 0x00007f013911a19a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#30 0x00007f01395000c8 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib64/libQt5Gui.so.5
#31 0x00007f01394d750c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Gui.so.5
#32 0x00007f013496014a in ?? () from /usr/lib64/libQt5XcbQpa.so.5
#33 0x00007f013585bfeb in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#34 0x00007f013585c268 in ?? () from /usr/lib64/libglib-2.0.so.0
#35 0x00007f013585c30f in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#36 0x00007f013916e660 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#37 0x00007f0139118d4b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#38 0x00007f013912093c in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
#39 0x00000000004205ef in ?? ()
#40 0x00007f01389641ad in __libc_start_main () from /lib64/libc.so.6
#41 0x00000000004210ca in ?? ()
[Inferior 1 (process 30905) detached]

Report to https://bugs.kde.org/
Comment 1 Albert Astals Cid 2021-04-25 22:27:00 UTC
It works here :/

can you run kpat under valgrind and make what you do to make it crash and attach here the valgrind log?

that is, run
  valgrind kpat
in a terminal (you may need to install valgrind first). Also be patient, everything will be much slower.

Also not sure if slackware has debug symbols, but if you could install the debug symbol packages for libQt5Widgets.so.5 it'd be best :)
Comment 2 Paulo 2021-04-26 13:07:01 UTC
Hi Albert, thanks for your reply.
It crashes every time here :/ I also tested in a VirtualBox vm clean install
to make sure and kpat crashes too. I didn't test with another distro.

Slackware strips debug symbols from its packages,
is it enough to build qt5 without strip?

There is a valgrind package for Slackware
https://github.com/Ponce/slackbuilds/tree/current/development/valgrind
is that right?

I'm a pt_BR user so I ran as 'LANG=C valgrind kpat' to translate some messages.
That's the terminal output:

$ LANG=C valgrind kpat
==6008== Memcheck, a memory error detector
==6008== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==6008== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info
==6008== Command: kpat
==6008== 
==6008== Conditional jump or move depends on uninitialised value(s)
==6008==    at 0x10A7ABD5: ???
==6008==    by 0xC78DAA7: ???
==6008== 
==6008== Conditional jump or move depends on uninitialised value(s)
==6008==    at 0x10A7ABD5: ???
==6008==    by 0xC78EDC7: ???
==6008== 
==6008== Conditional jump or move depends on uninitialised value(s)
==6008==    at 0x10A7ABD5: ???
==6008==    by 0xC790047: ???
==6008== 
==6008== Invalid read of size 8
==6008==    at 0x61E4B6E: QGraphicsScene::addItem(QGraphicsItem*) (in /usr/lib64/libQt5Widgets.so.5.15.2)
==6008==    by 0x491E972: KCardPile::insert(int, KCard*) (in /usr/lib64/libkcardgame.so)
==6008==    by 0x4921BA3: ??? (in /usr/lib64/libkcardgame.so)
==6008==    by 0x4922809: KCardScene::moveCardsToPile(QList<KCard*> const&, KCardPile*, int) (in /usr/lib64/libkcardgame.so)
==6008==    by 0x4924005: KCardScene::moveCardToPile(KCard*, KCardPile*, int) (in /usr/lib64/libkcardgame.so)
==6008==    by 0x427BBB: ??? (in /usr/bin/kpat)
==6008==    by 0x464B68: ??? (in /usr/bin/kpat)
==6008==    by 0x6DFBAF3: ??? (in /usr/lib64/libQt5Core.so.5.15.2)
==6008==    by 0x4916D51: KCardScene::cardRightClicked(KCard*) (in /usr/lib64/libkcardgame.so)
==6008==    by 0x4924ABC: KCardScene::mouseReleaseEvent(QGraphicsSceneMouseEvent*) (in /usr/lib64/libkcardgame.so)
==6008==    by 0x42AFCE: ??? (in /usr/bin/kpat)
==6008==    by 0x61EFC61: QGraphicsScene::event(QEvent*) (in /usr/lib64/libQt5Widgets.so.5.15.2)
==6008==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
==6008== 
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = kpat path = /usr/bin pid = 6008
KCrash: Arguments: /usr/bin/kpat 
KCrash: Attempting to start /usr/lib64/drkonqi

[1]+  Parado                  LANG=C valgrind kpat
paulo@paulobash~$ QSocketNotifier: Invalid socket 15 and type 'Read', disabling...
QSocketNotifier: Invalid socket 17 and type 'Read', disabling...

(kpat:6008): GLib-GIO-ERROR **: 10:02:44.704: inotify read(): Bad file descriptor
==6008== 
==6008== HEAP SUMMARY:
==6008==     in use at exit: 26,164,098 bytes in 58,034 blocks
==6008==   total heap usage: 410,092 allocs, 352,058 frees, 7,301,726,375 bytes allocated
==6008== 
==6008== LEAK SUMMARY:
==6008==    definitely lost: 1,824 bytes in 57 blocks
==6008==    indirectly lost: 0 bytes in 0 blocks
==6008==      possibly lost: 318,759 bytes in 46 blocks
==6008==    still reachable: 25,770,995 bytes in 57,269 blocks
==6008==                       of which reachable via heuristic:
==6008==                         newarray           : 24 bytes in 1 blocks
==6008==                         multipleinheritance: 3,336 bytes in 3 blocks
==6008==         suppressed: 0 bytes in 0 blocks
==6008== Rerun with --leak-check=full to see details of leaked memory
==6008== 
==6008== Use --track-origins=yes to see where uninitialised values come from
==6008== For lists of detected and suppressed errors, rerun with: -s
==6008== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)

[1]+  Fim da execução com status 253        LANG=C valgrind kpat
Comment 3 Albert Astals Cid 2021-04-26 21:58:17 UTC
That's sadly not very useful.

Does slackware have the hability to run flatpak?

If so could you try if using https://flathub.org/apps/details/org.kde.kpat still crashes for you?
Comment 4 Paulo 2021-04-26 22:41:25 UTC
This?
https://github.com/Ponce/slackbuilds/tree/current/desktop/flatpak

After some commands to download and install things, I think I did it right.
I could run kpat with 'flatpak run org.kde.kpat', it started with defaults instead my own configurations.
It crashed the same way, I started a Freecell game then changed it to Forecell.
Any card auto-moves with right-click, but right-click on any ace crashes.
Comment 5 Albert Astals Cid 2021-04-27 19:32:16 UTC
Ah, Forecell isn't a typo and it's actually a game type :D

Sorry, yes i can confirm it crashes here too.
Comment 6 Paulo 2021-04-27 19:46:21 UTC
(In reply to Albert Astals Cid from comment #5)
> Ah, Forecell isn't a typo and it's actually a game type :D
> 
> Sorry, yes i can confirm it crashes here too.

Yes :D try any Freecell variant, it should certainly (unfortunately) crash too.

Those Freecell variants were added with the new KDE applications update 21.04,
that's why I think maybe there is something related.
Before those variants addition, Freecell was running ok.
Comment 7 Albert Astals Cid 2021-05-04 22:22:43 UTC
Git commit d2372a8c2449aee6568148cf8b03bd8acd9aa025 by Albert Astals Cid, on behalf of Michael Lang.
Committed on 04/05/2021 at 22:21.
Pushed by aacid into branch 'master'.

Fix ace auto move crash

Ace foundation auto moves were crashing after the game type was changed. Now removing PatPile before removing Pile during game type change.

M  +10   -0    src/dealer.cpp
M  +1    -0    src/dealer.h
M  +3    -11   src/freecell.cpp

https://invent.kde.org/games/kpat/commit/d2372a8c2449aee6568148cf8b03bd8acd9aa025
Comment 8 Albert Astals Cid 2021-05-04 22:25:43 UTC
Git commit 638d8c2c6b47054bcf3deece3b065ac5c2fb01d8 by Albert Astals Cid, on behalf of Michael Lang.
Committed on 04/05/2021 at 22:23.
Pushed by aacid into branch 'release/21.04'.

Fix ace auto move crash

Ace foundation auto moves were crashing after the game type was changed. Now removing PatPile before removing Pile during game type change.
(cherry picked from commit d2372a8c2449aee6568148cf8b03bd8acd9aa025)

M  +10   -0    src/dealer.cpp
M  +1    -0    src/dealer.h
M  +3    -11   src/freecell.cpp

https://invent.kde.org/games/kpat/commit/638d8c2c6b47054bcf3deece3b065ac5c2fb01d8
Comment 9 Paulo 2021-05-05 02:11:49 UTC
Hey Albert thank you very much, I just downloaded and built kpat-master and it seems that it's fixed. Moving aces doesn't crash kpat anymore.
Output of 'kpat --version' is 'kpat 21.7.70'
Regards Paulo.