Bug 188413 - mahjongg crashs when trying to use custom layout
Summary: mahjongg crashs when trying to use custom layout
Status: RESOLVED WORKSFORME
Alias: None
Product: kmahjongg
Classification: Applications
Component: general (show other bugs)
Version: 0.8
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: Mauricio Piacentini
URL:
Keywords:
: 327337 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-03-29 18:51 UTC by Michael Skiba
Modified: 2018-12-01 03:45 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
My custom made layout (2.60 KB, application/octet-stream)
2009-03-29 18:54 UTC, Michael Skiba
Details
bounds checking in GameData::onlyFreeInLine() (4.54 KB, patch)
2013-01-01 13:58 UTC, Ian Simpson
Details
don't draw the board if game could not be generated (5.68 KB, patch)
2013-01-01 14:04 UTC, Ian Simpson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Skiba 2009-03-29 18:51:41 UTC
Version:           0.8 (using 4.2.68 (KDE 4.2.68 (KDE 4.3 >= 20090327)) "release 1.1", KDE:KDE4:UNSTABLE:Desktop / openSUSE_11.0)
Compiler:          gcc
OS:                Linux (i686) release 2.6.25.20-0.1-pae

Since I haven't found an boardeditor I used the one from kmahjongg(KDE3) to create a custom layout. Afterwards I moved it in the layout direction of kmahjongg(KDE4).

When I open the settings I see the in the terminal that it recognized my custom layout and it tries to load it (like all the other layouts). Also it's name is listed in the list, but then, when I click on the name it crashs with the following debugging output:
Anwendung: KMahjongg (kmahjongg), Signal SIGABRT
[?1034h[Thread debugging using libthread_db enabled]

Thread 1 (Thread 0xb5ebd6d0 (LWP 21132)):
[KCrash Handler]
#6  0xffffe430 in __kernel_vsyscall ()
#7  0xb660b900 in raise () from /lib/libc.so.6
#8  0xb660d238 in abort () from /lib/libc.so.6
#9  0xb664710d in ?? () from /lib/libc.so.6
#10 0xb664cfc4 in ?? () from /lib/libc.so.6
#11 0xb664e95c in free () from /lib/libc.so.6
#12 0xb72a3e5d in qFree () from /usr/lib/libQtCore.so.4
#13 0x080616c8 in GameData::onlyFreeInLine ()
#14 0x08061dcd in GameData::generateSolvableGame ()
#15 0x08062181 in GameData::generateStartPosition2 ()
#16 0x080596f0 in BoardWidget::calculateNewGame ()
#17 0x08062a2a in KMahjonggLayoutSelector::layoutChanged ()
#18 0x08062c7d in KMahjonggLayoutSelector::qt_metacall ()
#19 0xb73b3c68 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#20 0xb73b53f2 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#21 0xb6f29339 in QListWidget::currentItemChanged () from /usr/lib/libQtGui.so.4
#22 0xb6f2d079 in ?? () from /usr/lib/libQtGui.so.4
#23 0xb6f2f1f9 in QListWidget::qt_metacall () from /usr/lib/libQtGui.so.4
#24 0xb73b3c68 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#25 0xb73b53f2 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#26 0xb6f178e9 in QItemSelectionModel::currentChanged () from /usr/lib/libQtGui.so.4
#27 0xb6f17a8d in QItemSelectionModel::setCurrentIndex () from /usr/lib/libQtGui.so.4
#28 0xb6ec9646 in QAbstractItemView::mousePressEvent () from /usr/lib/libQtGui.so.4
#29 0xb69beca6 in QWidget::event () from /usr/lib/libQtGui.so.4
#30 0xb6d7b5e3 in QFrame::event () from /usr/lib/libQtGui.so.4
#31 0xb6e1b97f in QAbstractScrollArea::viewportEvent () from /usr/lib/libQtGui.so.4
#32 0xb6ecd9d7 in QAbstractItemView::viewportEvent () from /usr/lib/libQtGui.so.4
#33 0xb6e1df85 in ?? () from /usr/lib/libQtGui.so.4
#34 0xb739cb1a in QCoreApplicationPrivate::sendThroughObjectEventFilters () from /usr/lib/libQtCore.so.4
#35 0xb6967d8a in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4
#36 0xb6970a21 in QApplication::notify () from /usr/lib/libQtGui.so.4
#37 0xb78ebdad in KApplication::notify () from /usr/lib/libkdeui.so.5
#38 0xb739d90b in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4
#39 0xb696fa8e in QApplicationPrivate::sendMouseEvent () from /usr/lib/libQtGui.so.4
#40 0xb69dfa06 in ?? () from /usr/lib/libQtGui.so.4
#41 0xb69ded47 in QApplication::x11ProcessEvent () from /usr/lib/libQtGui.so.4
#42 0xb6a084dc in ?? () from /usr/lib/libQtGui.so.4
#43 0xb62002d9 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#44 0xb620385b in ?? () from /usr/lib/libglib-2.0.so.0
#45 0xb62039d8 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#46 0xb73c9488 in QEventDispatcherGlib::processEvents () from /usr/lib/libQtCore.so.4
#47 0xb6a07ba5 in ?? () from /usr/lib/libQtGui.so.4
#48 0xb739bf4a in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#49 0xb739c38a in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#50 0xb739e819 in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
#51 0xb6967c27 in QApplication::exec () from /usr/lib/libQtGui.so.4
#52 0x080527b7 in main ()
Comment 1 Michael Skiba 2009-03-29 18:54:09 UTC
Created attachment 32461 [details]
My custom made layout

Feel free to include it, if you like (increases the useable for girlfriend factor ;) )
Comment 2 Antonis Tsiapaliokas 2010-11-01 20:59:38 UTC
Hello

I am using opensuse 11.3 and the trunk version 4.5.73. I have tried out your layout but the kmahjongg have not seen it. Also you have only submit the .layout file without the .desktop one... I have tried the easy.layout from the kde-games-devel mailing list (http://lists.kde.org/?l=kde-games-devel&m=128785037713199&w=2) which it has been created by Mauricio Piacentini, so we can test the game without losing a lot of time, winning the game. And this layout works fine.. The kmahjongg recognize it and it is using it without any problem... So i think that there is no bug in the program but your layout is buggy...
Comment 3 Christian Krippendorf 2012-01-04 16:23:08 UTC
"So i think that there is no bug in the program but your layout is buggy..."

Even if the layout file is wrong, it should never make KMahjongg crashing. KMahjongg have to take care of handling wrong defined layout files.

But i also can't find any problem nor create a crash with a wrong layout.

Greez
Comment 4 Ian Wadham 2012-01-04 22:04:49 UTC
Could this be anything to do with the version change in layouts between KDE 3 and 4? Maybe the KMahjongg code to handle the old layout format is broken.
Comment 5 Christian Krippendorf 2012-01-04 22:09:11 UTC
Don't know that there was a layout file change. But i don't know about KMahjongg before KDE4. I don't really think this bug still exist. Maybe some little changes made it or the rewrite with KDE4.

Greez
Comment 6 Ian Wadham 2012-01-04 22:41:06 UTC
Yes, there definitely was a change in layout formats and there should be a version number at the start of the .layout file.  I remember this because many layout files were converted to the new format manually and a few ended up with an odd number of tiles and could not be solved ...

Maybe KMahjongg is assuming the wrong version in the layout-loader or maybe it no longer handles the old version correctly ...  But maybe this is a red herring.
Comment 7 Ian Simpson 2013-01-01 13:58:26 UTC
Created attachment 76120 [details]
bounds checking in GameData::onlyFreeInLine()

I think this is being caused by an out-of-bounds error, triggered by the fact that it's so difficult to generate a solvable board for the layout.
Comment 8 Ian Simpson 2013-01-01 14:04:11 UTC
Created attachment 76121 [details]
don't draw the board if game could not be generated

After the previous patch, the board would sometimes be drawn in an incomplete state when the program was started or the settings were changed and the board could not be generated.

I went a bit mad with it and decided to try to fix that too...
Comment 9 Christian Krippendorf 2013-01-01 15:29:57 UTC
Generating a solvable board Layout is a very complicated mission as seen in kmahjongg. I don't like the code about generating a solveable game. I made a more simple algorithm for generating a solveable game in JMahjongg. It simply builds a game backwards. The problem here is a specific game number.

For my opinion... the whole "generate solvable game"-code is bad. I also noticed problem with the 64 tries in the past.

Maybe we can optimize or replace the whole generating code with a better one, that fits our needs. 

Greez
Comment 10 Jekyll Wu 2013-11-08 23:19:11 UTC
*** Bug 327337 has been marked as a duplicate of this bug. ***
Comment 11 Frederik Schwarzer 2016-01-05 01:02:59 UTC
In current master this layout does not crash anymore but it's still not usable since it only shows up every other try.
Comment 12 Andrew Crouthamel 2018-11-01 13:46:18 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 13 Bug Janitor Service 2018-11-16 11:30:26 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 14 Bug Janitor Service 2018-12-01 03:45:14 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!