Bug 258998 - crash starting kolf
Summary: crash starting kolf
Status: RESOLVED FIXED
Alias: None
Product: kolf
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Stefan Majewsky
URL:
Keywords:
: 311392 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-06 12:03 UTC by Jaime Torres
Modified: 2012-12-20 19:47 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.10


Attachments
New crash information added by DrKonqi (5.11 KB, text/plain)
2011-11-19 23:19 UTC, Dwayne MacKinnon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jaime Torres 2010-12-06 12:03:41 UTC
Application: kolf (1.10)
KDE Platform Version: 4.5.85 (4.6 Beta2) (Compiled from sources)
Qt Version: 4.7.2
Operating System: Linux 2.6.36optimum x86_64
Distribution (Platform): openSUSE RPMs

-- Information about the crash:
- What I was doing when the application crashed:

Just starting. And this is what I see in the stdout:

kolf: /g/kde4svn/kdegames/kolf/external/Box2D/Collision/Shapes/b2PolygonShape.cpp:115: b2Vec2 ComputeCentroid(const b2Vec2*, int32): La declaración `area > b2_floatValues<sizeof(qreal)>::epsilon()' no se cumple.

The crash can be reproduced every time.

-- Backtrace:
Application: Kolf (kolf), signal: Aborted
[KCrash Handler]
#6  0x00007fc7efca7965 in raise () from /lib64/libc.so.6
#7  0x00007fc7efca8e66 in abort () from /lib64/libc.so.6
#8  0x00007fc7efca01d5 in __assert_fail () from /lib64/libc.so.6
#9  0x00007fc7f2bf1642 in ComputeCentroid (vs=<value optimized out>, count=8) at /g/kde4svn/kdegames/kolf/external/Box2D/Collision/Shapes/b2PolygonShape.cpp:115
#10 0x00007fc7f2bf1e20 in b2PolygonShape::Set (this=0x12b63c0, vertices=<value optimized out>, count=<value optimized out>)
    at /g/kde4svn/kdegames/kolf/external/Box2D/Collision/Shapes/b2PolygonShape.cpp:170
#11 0x00007fc7f2bcd92a in Kolf::EllipseShape::createShape (this=<value optimized out>) at /g/kde4svn/kdegames/kolf/shape.cpp:182
#12 0x00007fc7f2bcd209 in Kolf::Shape::update (this=0x141c000) at /g/kde4svn/kdegames/kolf/shape.cpp:119
#13 0x00007fc7f2bb67a0 in EllipticalCanvasItem::setSize (this=0xf8d5b0, size=<value optimized out>) at /g/kde4svn/kdegames/kolf/canvasitem.cpp:335
#14 0x00007fc7f2bc1ce0 in Kolf::BlackHole::BlackHole (this=0xf8d5b0, parent=<value optimized out>, world=<value optimized out>) at /g/kde4svn/kdegames/kolf/objects.cpp:43
#15 0x00007fc7f2bb0df4 in Kolf::ItemFactory::create<Kolf::BlackHole> (parent=0x1293280, world=0x1365000) at /g/kde4svn/kdegames/kolf/itemfactory.h:50
#16 0x00007fc7f2bbbda0 in Kolf::ItemFactory::createInstance (this=0xbf5f60, identifier=..., parent=0x1293280, world=0x1365000) at /g/kde4svn/kdegames/kolf/itemfactory.cpp:35
#17 0x00007fc7f2ba3a2f in KolfGame::openFile (this=0xc0b480) at /g/kde4svn/kdegames/kolf/game.cpp:1794
#18 0x00007fc7f2ba48b6 in KolfGame::startNextHole (this=0xc0b480) at /g/kde4svn/kdegames/kolf/game.cpp:1651
#19 0x00007fc7f2ba5f70 in KolfGame::startFirstHole (this=0xc0b480, hole=1) at /g/kde4svn/kdegames/kolf/game.cpp:615
#20 0x00007fc7f2baf2eb in KolfWindow::createSpacer (this=0xbf5e00) at /g/kde4svn/kdegames/kolf/kolf.cpp:422
#21 0x00007fc7f2bb0b2c in KolfWindow::qt_metacall (this=0xbf5e00, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fffe9888d10) at /g/b451/kdegames/kolf/kolf.moc:147
#22 0x00007fc7f0aee8b7 in QMetaObject::activate (sender=0x11c9d00, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x0) at /g/kde4svn/qt/src/corelib/kernel/qobject.cpp:3278
#23 0x00007fc7f0af44ff in QSingleShotTimer::timerEvent (this=0x11c9d00) at /g/kde4svn/qt/src/corelib/kernel/qtimer.cpp:308
#24 0x00007fc7f0aed4a1 in QObject::event (this=0x11c9d00, e=<value optimized out>) at /g/kde4svn/qt/src/corelib/kernel/qobject.cpp:1181
#25 0x00007fc7f19caaa4 in QApplicationPrivate::notify_helper (this=0xbf5380, receiver=0x11c9d00, e=0x7fffe9889480) at /g/kde4svn/qt/src/gui/kernel/qapplication.cpp:4462
#26 0x00007fc7f19cfa98 in QApplication::notify (this=<value optimized out>, receiver=0x11c9d00, e=0x7fffe9889480) at /g/kde4svn/qt/src/gui/kernel/qapplication.cpp:4341
#27 0x00007fc7f26fa2d6 in KApplication::notify (this=0x7fffe98897d0, receiver=0x11c9d00, event=0x7fffe9889480) at /g/kde4svn/kdelibs/kdeui/kernel/kapplication.cpp:311
#28 0x00007fc7f0ad9813 in QCoreApplication::QCoreApplication::notifyInternal (this=0x7fffe98897d0, receiver=0x11c9d00, event=0x7fffe9889480)
    at /g/kde4svn/qt/src/corelib/kernel/qcoreapplication.cpp:731
#29 0x00007fc7f0b0673e in QCoreApplication::sendEvent (this=0xbf4110) at ../../include/QtCore/../../../../kde4svn/qt/src/corelib/kernel/qcoreapplication.h:215
#30 QTimerInfoList::activateTimers (this=0xbf4110) at /g/kde4svn/qt/src/corelib/kernel/qeventdispatcher_unix.cpp:603
#31 0x00007fc7f0b03874 in timerSourceDispatch (source=<value optimized out>) at /g/kde4svn/qt/src/corelib/kernel/qeventdispatcher_glib.cpp:184
#32 0x00007fc7ec75bf43 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#33 0x00007fc7ec75c720 in ?? () from /lib64/libglib-2.0.so.0
#34 0x00007fc7ec75c9c0 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#35 0x00007fc7f0b03f4f in QEventDispatcherGlib::QEventDispatcherGlib::processEvents (this=0xbf1180, flags=<value optimized out>) at /g/kde4svn/qt/src/corelib/kernel/qeventdispatcher_glib.cpp:422
#36 0x00007fc7f1a6e9ee in QGuiEventDispatcherGlib::QGuiEventDispatcherGlib::processEvents (this=<value optimized out>, flags=<value optimized out>)
    at /g/kde4svn/qt/src/gui/kernel/qguieventdispatcher_glib.cpp:204
#37 0x00007fc7f0ad8c22 in QEventLoop::QEventLoop::processEvents (this=<value optimized out>, flags=...) at /g/kde4svn/qt/src/corelib/kernel/qeventloop.cpp:149
#38 0x00007fc7f0ad8e64 in QEventLoop::QEventLoop::exec (this=0x7fffe9889710, flags=...) at /g/kde4svn/qt/src/corelib/kernel/qeventloop.cpp:201
#39 0x00007fc7f0add223 in QCoreApplication::QCoreApplication::exec () at /g/kde4svn/qt/src/corelib/kernel/qcoreapplication.cpp:1008
#40 0x000000000040285d in main (argc=1, argv=0x7fffe9889de8) at /g/kde4svn/kdegames/kolf/main.cpp:106

Reported using DrKonqi
Comment 1 Stefan Majewsky 2010-12-07 23:37:28 UTC
SVN commit 1204551 by majewsky:

Let's see if that does away with that weird crash some people get when starting Kolf.

BUG: 258998

 M  +4 -2      shape.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1204551
Comment 2 Jaime Torres 2010-12-08 10:32:31 UTC
Unfortunately, it is still there..
More information:
			const qreal angle = -i * angleStep; //CCW order as required by Box2D
			vertices[i].x = c.x + rx * cos(angle);
			vertices[i].y = c.y + ry * sin(angle);
		fprintf(stderr, "vertices %f,%f\n", vertices[i].x, vertices[i].y); // yes, I know about kDebug, but...

Those are the vertices of the elipse that generates the crash:

0,200000,0,000000
0,141421,-0,159099
0,000000,-0,225000
-0,141421,-0,159099
-0,200000,-0,000000
-0,141421,0,159099
-0,000000,0,225000
0,141421,0,159099

when creating a blackhole (and a crash :-().
Comment 3 Jaime Torres 2011-06-22 17:23:29 UTC
A patch that fixes the problem for me.
An area can not be a negative number in the R*R universe.


Index: external/Box2D/Collision/Shapes/b2PolygonShape.cpp
===================================================================
--- external/Box2D/Collision/Shapes/b2PolygonShape.cpp  (revisión: 1237890)
+++ external/Box2D/Collision/Shapes/b2PolygonShape.cpp  (copia de trabajo)
@@ -103,8 +103,7 @@ static b2Vec2 ComputeCentroid(const b2Ve
                b2Vec2 e2 = p3 - p1;
 
                qreal D = b2Cross(e1, e2);

-               qreal triangleArea = 0.5f * D;
+               qreal triangleArea = D < 0 ? -0.5f * D : 0.5f * D;
                area += triangleArea;
 
                // Area weighted centroid
Comment 4 Dwayne MacKinnon 2011-11-19 23:19:04 UTC
Created attachment 65854 [details]
New crash information added by DrKonqi

kolf (1.10) on KDE Platform 4.7.3 (4.7.3) using Qt 4.7.4

Just some additional information. This is with KDE 4.7.3 on FreeBSD 8.2-RELEASE.

-- Backtrace (Reduced):
#11 0x28135925 in ComputeCentroid (vs=0x2bf0f0a0, count=8) at /usr/ports/games/kdegames4/work/kdegames-4.7.3/kolf/external/Box2D/Collision/Shapes/b2PolygonShape.cpp:115
#12 0x28135b4e in b2PolygonShape::Set (this=0x2bf0f080, vertices=0xbfbfd3b8, count=8) at /usr/ports/games/kdegames4/work/kdegames-4.7.3/kolf/external/Box2D/Collision/Shapes/b2PolygonShape.cpp:170
#13 0x28107798 in Kolf::EllipseShape::createShape (this=0x2c2619c0) at /usr/ports/games/kdegames4/work/kdegames-4.7.3/kolf/shape.cpp:184
#14 0x28107b65 in Kolf::Shape::update (this=0x2c2619c0) at /usr/ports/games/kdegames4/work/kdegames-4.7.3/kolf/shape.cpp:119
#15 0x28107d7f in Kolf::EllipseShape::setRect (this=0x2c2619c0, rect=@0xbfbfd630) at /usr/ports/games/kdegames4/work/kdegames-4.7.3/kolf/shape.cpp:150
Comment 5 josan_pansa 2012-12-10 10:10:41 UTC
*** Bug 311392 has been marked as a duplicate of this bug. ***
Comment 6 Jaime Torres 2012-12-19 19:56:20 UTC
Git commit 5ff7428e8481f285c5e32c3a4b0be01f921fd388 by Jaime Torres.
Committed on 19/12/2012 at 20:51.
Pushed by jtamate into branch 'master'.

fix a crash in box2d (that also crashes kolf)

with some data extracted from a kolf course, box2d calculates a
negative area, that is not possible in Real*Real vector space.

fixed using the abs area of each triangle.

Also filled a bug in box2d (I have had to use okteta to bypass their
captcha).
FIXED-IN: 4.10
REVIEW: 107739

M  +1    -1    external/Box2D/Collision/Shapes/b2PolygonShape.cpp

http://commits.kde.org/kolf/5ff7428e8481f285c5e32c3a4b0be01f921fd388
Comment 7 Jaime Torres 2012-12-20 08:04:37 UTC
FYI: The box2d info about this bug:
http://www.box2d.org/forum/viewtopic.php?f=4&t=8998
Comment 8 Jaime Torres 2012-12-20 19:47:54 UTC
Git commit 08e0ec93940ca2da4f46bd277ecafeb5f7ffa772 by Jaime Torres.
Committed on 19/12/2012 at 20:51.
Pushed by jtamate into branch 'KDE/4.10'.

fix a crash in box2d (that also crashes kolf)

with some data extracted from a kolf course, box2d calculates a
negative area, that is not possible in Real*Real vector space.

fixed using the abs area of each triangle.

Also filled a bug in box2d (I have had to use okteta to bypass their
captcha).
FIXED-IN: 4.10
REVIEW: 107739

M  +1    -1    external/Box2D/Collision/Shapes/b2PolygonShape.cpp

http://commits.kde.org/kolf/08e0ec93940ca2da4f46bd277ecafeb5f7ffa772