the-butterfly-effect / tbe

The Butterfly Effect, a realistic physics simulation game
http://the-butterfly-effect.org
GNU General Public License v2.0
97 stars 13 forks source link

Undo/reset crashes #230

Closed Wuzzy2 closed 8 years ago

Wuzzy2 commented 8 years ago

I found a hard-to-reproduce crash: If you use a lot of undo and reset (reset the parts, not the timer reset!) in one particular level while constantly adding and modifying stuff, eventually TBE will crash. Sometimes TBE crashes by doing two resets in row. This issue is probably about two problems, actually, but I am not sure. It does not always happen and I have not yet figured out the exact cause of the crashes.

Here's what happened after an undo:

Console:

Thread 1 "tbe" received signal SIGSEGV, Segmentation fault.
0x00007ffff72d529c in QGraphicsItem::collidingItems(Qt::ItemSelectionMode) const () from /usr/lib/libQt5Widgets.so.5

Backtrace:

#0  0x00007ffff72d529c in QGraphicsItem::collidingItems(Qt::ItemSelectionMode) const () from /usr/lib/libQt5Widgets.so.5
#1  0x00000000004ab750 in AbstractUndoCommand::isViewObjectColliding (this=0x1204380) at /home/wuzzy/src/tbe/tbe/src/control/AbstractUndoCommand.cpp:83
#2  0x00000000004abe40 in AbstractUndoCommand::setDecoratorStateUndoRedo (this=0x1204380) at /home/wuzzy/src/tbe/tbe/src/control/AbstractUndoCommand.cpp:170
#3  0x00000000004ab557 in AbstractUndoCommand::~AbstractUndoCommand (this=0x1204380, __in_chrg=<optimized out>)
    at /home/wuzzy/src/tbe/tbe/src/control/AbstractUndoCommand.cpp:49
#4  0x00000000004b0af4 in MoveUndoCommand::~MoveUndoCommand (this=0x1204380, __in_chrg=<optimized out>) at /home/wuzzy/src/tbe/tbe/src/control/MoveUndoCommand.h:27
#5  0x00000000004b0b10 in MoveUndoCommand::~MoveUndoCommand (this=0x1204380, __in_chrg=<optimized out>) at /home/wuzzy/src/tbe/tbe/src/control/MoveUndoCommand.h:27
#6  0x00000000004b3236 in UndoSingleton::createUndoCommand (anObject=..., anUndoType=ActionIcon::ACTION_MOVE) at /home/wuzzy/src/tbe/tbe/src/control/UndoSingleton.cpp:93
#7  0x0000000000538c70 in ViewObject::mouseMoveEvent (this=0x225ea70, anEvent=0x7fffffffd1a0) at /home/wuzzy/src/tbe/tbe/src/view/ViewObject.cpp:191
#8  0x00007ffff72df52c in QGraphicsItem::sceneEvent(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#9  0x00007ffff7306641 in ?? () from /usr/lib/libQt5Widgets.so.5
#10 0x00007ffff730c236 in QGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent*) () from /usr/lib/libQt5Widgets.so.5
#11 0x00007ffff7317bf4 in QGraphicsScene::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#12 0x00007ffff6fec7bc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#13 0x00007ffff6ff195f in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#14 0x00007ffff62c4280 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#15 0x00007ffff73306d7 in QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent*) () from /usr/lib/libQt5Widgets.so.5
#16 0x000000000053287e in ResizingGraphicsView::mouseMoveEvent (this=0xbf9f00, event=0x7fffffffd7e0) at /home/wuzzy/src/tbe/tbe/src/view/resizinggraphicsview.cpp:112
#17 0x00007ffff7031298 in QWidget::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#18 0x00007ffff712d73e in QFrame::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#19 0x00007ffff733356b in QGraphicsView::viewportEvent(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#20 0x00007ffff62c3fe1 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#21 0x00007ffff6fec795 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#22 0x00007ffff6ff2727 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#23 0x00007ffff62c4280 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#24 0x00007ffff6ff0ee5 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) ()
   from /usr/lib/libQt5Widgets.so.5
#25 0x00007ffff704b2c3 in ?? () from /usr/lib/libQt5Widgets.so.5
#26 0x00007ffff704d793 in ?? () from /usr/lib/libQt5Widgets.so.5
#27 0x00007ffff6fec7bc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#28 0x00007ffff6ff195f in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#29 0x00007ffff62c4280 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#30 0x00007ffff6810693 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/libQt5Gui.so.5
#31 0x00007ffff6811ea5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/libQt5Gui.so.5
#32 0x00007ffff67ef18b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Gui.so.5
#33 0x00007fffecb56080 in ?? () from /usr/lib/libQt5XcbQpa.so.5
#34 0x00007ffff4ab6dd7 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#35 0x00007ffff4ab7040 in ?? () from /usr/lib/libglib-2.0.so.0
#36 0x00007ffff4ab70ec in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#37 0x00007ffff631a6cf in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#38 0x00007ffff62c246a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#39 0x00007ffff62caa0c in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
#40 0x00000000004ca9c6 in main (argc=1, argv=0x7fffffffe428) at /home/wuzzy/src/tbe/tbe/src/main.cpp:290

There's another QPointer-related crash. Here's what happend after a reset:

QSharedPointer: internal self-check failed: pointer 0x28a7790 was already tracked by another QSharedPointer object 0x27709a0
Thread 1 "tbe" received signal SIGABRT, Aborted.
0x00007ffff5434295 in raise () from /usr/lib/libc.so.6

Backtrace:

#0  0x00007ffff5434295 in raise () from /usr/lib/libc.so.6
#1  0x00007ffff54356da in abort () from /usr/lib/libc.so.6
#2  0x00007ffff60d5c61 in QMessageLogger::fatal(char const*, ...) const () from /usr/lib/libQt5Core.so.5
#3  0x00007ffff6175041 in QtSharedPointer::internalSafetyCheckAdd(void const*, void const volatile*) () from /usr/lib/libQt5Core.so.5
#4  0x00000000004cba80 in QSharedPointer<ViewObject>::internalConstruct<QtSharedPointer::NormalDeleter> (this=0x7fffffffca30, ptr=0x28a7790, deleter=...)
    at /usr/include/qt/QtCore/qsharedpointer_impl.h:524
#5  0x00000000004cb9c5 in QSharedPointer<ViewObject>::QSharedPointer (this=0x7fffffffca30, ptr=0x28a7790) at /usr/include/qt/QtCore/qsharedpointer_impl.h:312
#6  0x00000000004cf7f3 in ViewObject::factoryMethod<ViewObject, std::shared_ptr<AbstractObject>, QString&>(std::shared_ptr<AbstractObject>&&, QString&) (
    __args#0=<unknown type in /home/wuzzy/src/tbe/tbe/usr/games/tbe, CU 0x3699b7, DIE 0x396887>, __args#1=...) at /home/wuzzy/src/tbe/tbe/src/view/ViewObject.h:58
#7  0x00000000004cd754 in AbstractObject::createViewObject (this=0xdea120, aDefaultDepth=2) at /home/wuzzy/src/tbe/tbe/src/model/AbstractObject.cpp:187
#8  0x00000000004f702e in World::addAbstractObjectToViewWorld (this=0x2861fb0, anAOPtr=std::shared_ptr (count 3, weak 1) 0xdea120)
    at /home/wuzzy/src/tbe/tbe/src/model/World.cpp:145
#9  0x00000000004f78a8 in World::createScene (this=0x2861fb0, myRSGVPtr=0xb91460) at /home/wuzzy/src/tbe/tbe/src/model/World.cpp:229
#10 0x0000000000526bf3 in MainWindow::repopulateScene (this=0x7fffffffe040) at /home/wuzzy/src/tbe/tbe/src/view/MainWindow.cpp:436
#11 0x0000000000525005 in MainWindow::loadLevel (this=0x7fffffffe040, aFileName=...) at /home/wuzzy/src/tbe/tbe/src/view/MainWindow.cpp:125
#12 0x0000000000526b68 in MainWindow::reloadLevel (this=0x7fffffffe040) at /home/wuzzy/src/tbe/tbe/src/view/MainWindow.cpp:427
#13 0x000000000052e9f5 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (MainWindow::*)()>::call(void (MainWindow::*)(), MainWindow*, void**) (f=(void (MainWindow::*)(MainWindow * const)) 0x526a9a <MainWindow::reloadLevel()>, o=0x7fffffffe040, arg=0x7fffffffcee0) at /usr/include/qt/QtCore/qobjectdefs_impl.h:501
#14 0x000000000052e987 in QtPrivate::FunctionPointer<void (MainWindow::*)()>::call<QtPrivate::List<>, void>(void (MainWindow::*)(), MainWindow*, void**) (
    f=(void (MainWindow::*)(MainWindow * const)) 0x526a9a <MainWindow::reloadLevel()>, o=0x7fffffffe040, arg=0x7fffffffcee0)
    at /usr/include/qt/QtCore/qobjectdefs_impl.h:520
#15 0x000000000052e827 in QtPrivate::QSlotObject<void (MainWindow::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (
    which=1, this_=0xb76410, r=0x7fffffffe040, a=0x7fffffffcee0, ret=0x0) at /usr/include/qt/QtCore/qobject_impl.h:143
#16 0x00007ffff62f171c in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQt5Core.so.5
#17 0x0000000000547923 in ResizingGraphicsView::signal_actionReload (this=0xb91460) at /home/wuzzy/src/tbe/tbe/build/src/moc_resizinggraphicsview.cpp:218
#18 0x0000000000515b9b in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (ResizingGraphicsView::*)()>::call(void (ResizingGraphicsView::*)(), ResizingGraphicsView*, void**) (f=(void (ResizingGraphicsView::*)(ResizingGraphicsView * const)) 0x5478fa <ResizingGraphicsView::signal_actionReload()>, o=0xb91460, 
    arg=0x7fffffffd0c0) at /usr/include/qt/QtCore/qobjectdefs_impl.h:501
#19 0x0000000000515b2d in QtPrivate::FunctionPointer<void (ResizingGraphicsView::*)()>::call<QtPrivate::List<>, void>(void (ResizingGraphicsView::*)(), ResizingGraphicsView*, void**) (f=(void (ResizingGraphicsView::*)(ResizingGraphicsView * const)) 0x5478fa <ResizingGraphicsView::signal_actionReload()>, o=0xb91460, arg=0x7fffffffd0c0)
    at /usr/include/qt/QtCore/qobjectdefs_impl.h:520
#20 0x0000000000515a97 in QtPrivate::QSlotObject<void (ResizingGraphicsView::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*)
    (which=1, this_=0x222c920, r=0xb91460, a=0x7fffffffd0c0, ret=0x0) at /usr/include/qt/QtCore/qobject_impl.h:143
#21 0x00007ffff62f171c in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQt5Core.so.5
#22 0x0000000000543901 in GameResources::signalReloadLevel (this=0xb9b810) at /home/wuzzy/src/tbe/tbe/build/src/moc_GameResources.cpp:138
#23 0x00000000005134d3 in GameResources::on_theResetButton_clicked (this=0xb9b810) at /home/wuzzy/src/tbe/tbe/src/view/GameResources.cpp:81
#24 0x0000000000543743 in GameResources::qt_static_metacall (_o=0xb9b810, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0x7fffffffd300)
    at /home/wuzzy/src/tbe/tbe/build/src/moc_GameResources.cpp:82
#25 0x00000000005438b0 in GameResources::qt_metacall (this=0xb9b810, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0x7fffffffd300)
    at /home/wuzzy/src/tbe/tbe/build/src/moc_GameResources.cpp:125
#26 0x00007ffff62f13a7 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQt5Core.so.5
#27 0x00007ffff737aad2 in QAbstractButton::clicked(bool) () from /usr/lib/libQt5Widgets.so.5
#28 0x00007ffff70e7a44 in ?? () from /usr/lib/libQt5Widgets.so.5
#29 0x00007ffff70e8637 in ?? () from /usr/lib/libQt5Widgets.so.5
#30 0x00007ffff70e8814 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libQt5Widgets.so.5
#31 0x00007ffff7031298 in QWidget::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#32 0x00007ffff6fec7bc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#33 0x00007ffff6ff2727 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#34 0x00007ffff62c4280 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#35 0x00007ffff6ff0ee5 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) ()
   from /usr/lib/libQt5Widgets.so.5
#36 0x00007ffff704b2c3 in ?? () from /usr/lib/libQt5Widgets.so.5
---Type <return> to continue, or q <return> to quit---
#37 0x00007ffff704d793 in ?? () from /usr/lib/libQt5Widgets.so.5
#38 0x00007ffff6fec7bc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#39 0x00007ffff6ff195f in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#40 0x00007ffff62c4280 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#41 0x00007ffff6810693 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/libQt5Gui.so.5
#42 0x00007ffff6811ea5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/libQt5Gui.so.5
#43 0x00007ffff67ef18b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Gui.so.5
#44 0x00007fffecb56080 in ?? () from /usr/lib/libQt5XcbQpa.so.5
#45 0x00007ffff4ab6dd7 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#46 0x00007ffff4ab7040 in ?? () from /usr/lib/libglib-2.0.so.0
#47 0x00007ffff4ab70ec in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#48 0x00007ffff631a6cf in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#49 0x00007ffff62c246a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#50 0x00007ffff62caa0c in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
#51 0x00000000004ca9c6 in main (argc=1, argv=0x7fffffffe428) at /home/wuzzy/src/tbe/tbe/src/main.cpp:290

ea741b57ee1c01ac3f707f91c0d3d079f2d337b6

kaa-ching commented 8 years ago

Hi Wuzzy, In the case of a pointer crash, it probably makes more sense to have a dump of the logging. But I'm sure I know where the cause is: the destructor of ViewWorld (i.e. the destructor of a QGraphicsScene) deletes all remaining ViewObjects. There shouldn't be any at that time - which is why the administration of the shared pointers goes bonkers... If you run with -verbosity=5 and dump the full log (please as zipped attachment), we can figure out what the original object was, and why it wasn't deleted properly.

kaa-ching commented 8 years ago

By now I realized that several more objects have pointers that need clearing, so expect another patch like the last one for issue #228 .

kaa-ching commented 8 years ago

And again, this is all due to the changes I needed to make for issue #223.

kaa-ching commented 8 years ago

Note: I think I only fixed the QSharedPointer thingie - not the collision issue. I'm not sure how to fix that, it seems to be a Qt-internal issue :cry:

amarsman commented 8 years ago

Anybody a reproducible scenario to show the problem?

Wuzzy2 commented 8 years ago

Yes, me!

Log: http://lpaste.net/raw/164328 My Qt version: 5.6.0 TBE revision: c3b4c4ce462f1b5c6dfc3eecdc1ff43020ffed00

amarsman commented 8 years ago

This reproduces on OS X with the same version, I only needed to click on one of the pie menu items to make it segfault.

Call stack:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 org.qt-project.QtWidgets 0x0000000101448454 QGraphicsItem::childItems() const + 36 1 org.the-butterfly-effect 0x0000000100ebbcd6 AbstractUndoCommand::isViewObjectColliding() + 422 2 org.the-butterfly-effect 0x0000000100ebb8c9 AbstractUndoCommand::setDecoratorStateUndoRedo() + 25 3 org.the-butterfly-effect 0x0000000100ebb83e AbstractUndoCommand::~AbstractUndoCommand() + 286 4 org.the-butterfly-effect 0x0000000100ec2085 0x100eb8000 + 41093 5 org.the-butterfly-effect 0x0000000100ec2035 0x100eb8000 + 41013 6 org.the-butterfly-effect 0x0000000100ec2059 0x100eb8000 + 41049 7 org.the-butterfly-effect 0x0000000100ec4d8a UndoSingleton::createUndoCommand(QSharedPointer, ActionIcon::ActionType) + 1770 8 org.the-butterfly-effect 0x0000000100f5d618 PieMenu::iconClicked(ActionIcon) + 104 9 org.the-butterfly-effect 0x0000000100f780c3 0x100eb8000 + 786627 10 org.qt-project.QtCore 0x0000000101f6b5bd QMetaObject::activate(QObject, int, int, void) + 749 11 org.the-butterfly-effect 0x0000000100f77cfa ActionIcon::clicked(ActionIcon) + 74 12 org.the-butterfly-effect 0x0000000100f7b200 0x100eb8000 + 799232 13 org.qt-project.QtWidgets 0x0000000101452003 QGraphicsItem::sceneEvent(QEvent) + 531 14 org.qt-project.QtWidgets 0x000000010147815e 0x10113f000 + 3379550 15 org.qt-project.QtWidgets 0x0000000101479ce1 0x10113f000 + 3386593 16 org.qt-project.QtWidgets 0x000000010147a561 0x10113f000 + 3388769 17 org.qt-project.QtWidgets 0x000000010148478a QGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent) + 90 18 org.the-butterfly-effect 0x0000000100f6e06c ViewWorld::mousePressEvent(QGraphicsSceneMouseEvent) + 204 19 org.qt-project.QtWidgets 0x000000010147f522 QGraphicsScene::event(QEvent_) + 1474 20 org.qt-project.QtWidgets 0x000000010114fb76 QApplicationPrivate::notifyhelper(QObject, QEvent) + 294 21 org.qt-project.QtWidgets 0x00000001011524c0 QApplication::notify(QObject, QEvent) + 5648 22 org.qt-project.QtCore 0x0000000101f383f4 QCoreApplication::notifyInternal2(QObject, QEvent) + 164 23 org.qt-project.QtWidgets 0x00000001014a752e QGraphicsView::mousePressEvent(QMouseEvent) + 1006 24 org.qt-project.QtWidgets 0x000000010118f0a3 QWidget::event(QEvent) + 1635 25 org.qt-project.QtWidgets 0x0000000101280ffd QFrame::event(QEvent) + 45 26 org.qt-project.QtWidgets 0x000000010130c8f3 QAbstractScrollArea::viewportEvent(QEvent) + 179 27 org.qt-project.QtWidgets 0x00000001014a6419 QGraphicsView::viewportEvent(QEvent) + 1673 28 org.qt-project.QtWidgets 0x000000010130d4a5 0x10113f000 + 1893541 29 org.qt-project.QtCore 0x0000000101f3868a QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject, QEvent) + 202 30 org.qt-project.QtWidgets 0x000000010114fb61 QApplicationPrivate::notifyhelper(QObject, QEvent) + 273 31 org.qt-project.QtWidgets 0x00000001011531fd QApplication::notify(QObject, QEvent) + 9037 32 org.qt-project.QtCore 0x0000000101f383f4 QCoreApplication::notifyInternal2(QObject, QEvent) + 164 33 org.qt-project.QtWidgets 0x00000001011504f8 QApplicationPrivate::sendMouseEvent(QWidget, QMouseEvent, QWidget, QWidget_, QWidget, QPointer&, bool) + 968 34 org.qt-project.QtWidgets 0x00000001011b064d 0x10113f000 + 464461 35 org.qt-project.QtWidgets 0x00000001011af78a 0x10113f000 + 460682 36 org.qt-project.QtWidgets 0x000000010114fb76 QApplicationPrivate::notifyhelper(QObject, QEvent) + 294 37 org.qt-project.QtWidgets 0x00000001011524c0 QApplication::notify(QObject, QEvent) + 5648 38 org.qt-project.QtCore 0x0000000101f383f4 QCoreApplication::notifyInternal2(QObject, QEvent_) + 164 39 org.qt-project.QtGui 0x00000001017b79da QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) + 2794 40 org.qt-project.QtGui 0x00000001017a0dfb QWindowSystemInterface::sendWindowSystemEvents(QFlagsQEventLoop::ProcessEventsFlag) + 155 41 libqcocoa.dylib 0x0000000105135481 0x105112000 + 144513 42 com.apple.CoreFoundation 0x00007fff93ee2881 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 43 com.apple.CoreFoundation 0x00007fff93ec1fbc CFRunLoopDoSources0 + 556 44 com.apple.CoreFoundation 0x00007fff93ec14df CFRunLoopRun + 927 45 com.apple.CoreFoundation 0x00007fff93ec0ed8 CFRunLoopRunSpecific + 296 46 com.apple.HIToolbox 0x00007fff8dac0935 RunCurrentEventLoopInMode + 235 47 com.apple.HIToolbox 0x00007fff8dac0677 ReceiveNextEventCommon + 184 48 com.apple.HIToolbox 0x00007fff8dac05af _BlockUntilNextEventMatchingListInModeWithFilter + 71 49 com.apple.AppKit 0x00007fff8ef76df6 _DPSNextEvent + 1067 50 com.apple.AppKit 0x00007fff8ef76226 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454 51 com.apple.AppKit 0x00007fff8ef6ad80 -[NSApplication run] + 682 52 libqcocoa.dylib 0x000000010513437f 0x105112000 + 140159 53 org.qt-project.QtCore 0x0000000101f347a1 QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) + 401 54 org.qt-project.QtCore 0x0000000101f38a65 QCoreApplication::exec() + 341 55 org.the-butterfly-effect 0x0000000100edfb48 main + 4360 56 libdyld.dylib 0x00007fff9644e5ad start + 1

Wuzzy2 commented 8 years ago

Hmm, it seems you also have to click on one of the items in the pie menu after you clicked the floor (not sure).

The actual error is “Segmentation fault”.

Stack trace by gdb:

Thread 1 "tbe" received signal SIGSEGV, Segmentation fault.
0x00007ffff750b29c in QGraphicsItem::collidingItems(Qt::ItemSelectionMode) const () from /usr/lib/libQt5Widgets.so.5
(gdb) bt
#0  0x00007ffff750b29c in QGraphicsItem::collidingItems(Qt::ItemSelectionMode) const () from /usr/lib/libQt5Widgets.so.5
#1  0x00000000004ab850 in AbstractUndoCommand::isViewObjectColliding (this=0x1769530) at /home/wuzzy/src/tbe/tbe/src/control/AbstractUndoCommand.cpp:83
#2  0x00000000004abf40 in AbstractUndoCommand::setDecoratorStateUndoRedo (this=0x1769530) at /home/wuzzy/src/tbe/tbe/src/control/AbstractUndoCommand.cpp:170
#3  0x00000000004ab657 in AbstractUndoCommand::~AbstractUndoCommand (this=0x1769530, __in_chrg=<optimized out>)
    at /home/wuzzy/src/tbe/tbe/src/control/AbstractUndoCommand.cpp:49
#4  0x00000000004b0bf4 in MoveUndoCommand::~MoveUndoCommand (this=0x1769530, __in_chrg=<optimized out>) at /home/wuzzy/src/tbe/tbe/src/control/MoveUndoCommand.h:27
#5  0x00000000004b0c10 in MoveUndoCommand::~MoveUndoCommand (this=0x1769530, __in_chrg=<optimized out>) at /home/wuzzy/src/tbe/tbe/src/control/MoveUndoCommand.h:27
#6  0x00000000004b3336 in UndoSingleton::createUndoCommand (anObject=..., anUndoType=ActionIcon::ACTION_MOVE) at /home/wuzzy/src/tbe/tbe/src/control/UndoSingleton.cpp:93
#7  0x000000000052fc26 in PieMenu::iconClicked (this=0x195cdd0, anIconPtr=0x1973010) at /home/wuzzy/src/tbe/tbe/src/view/PieMenu.cpp:170
#8  0x0000000000545f63 in PieMenu::qt_static_metacall (_o=0x195cdd0, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0x7fffffffccb0)
    at /home/wuzzy/src/tbe/tbe/build/src/moc_PieMenu.cpp:335
#9  0x00007ffff6527679 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQt5Core.so.5
#10 0x0000000000545ebb in ActionIcon::clicked (this=0x1973010, _t1=0x1973010) at /home/wuzzy/src/tbe/tbe/build/src/moc_PieMenu.cpp:264
#11 0x0000000000548409 in ActionIcon::mousePressEvent (this=0x1973010) at /home/wuzzy/src/tbe/tbe/build/src/../../src/view/PieMenu.h:95
#12 0x00007ffff7515542 in QGraphicsItem::sceneEvent(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#13 0x00007ffff753c641 in ?? () from /usr/lib/libQt5Widgets.so.5
#14 0x00007ffff7545336 in ?? () from /usr/lib/libQt5Widgets.so.5
#15 0x00007ffff75457a9 in QGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent*) () from /usr/lib/libQt5Widgets.so.5
#16 0x000000000053d8c4 in ViewWorld::mousePressEvent (this=0x129a4c0, mouseEvent=0x7fffffffd230) at /home/wuzzy/src/tbe/tbe/src/view/ViewWorld.cpp:92
#17 0x00007ffff754dc10 in QGraphicsScene::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#18 0x00007ffff72227bc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#19 0x00007ffff722795f in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#20 0x00007ffff64fa280 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#21 0x00007ffff75680af in QGraphicsView::mousePressEvent(QMouseEvent*) () from /usr/lib/libQt5Widgets.so.5
#22 0x00007ffff7267aff in QWidget::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#23 0x00007ffff736373e in QFrame::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#24 0x00007ffff756956b in QGraphicsView::viewportEvent(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#25 0x00007ffff64f9fe1 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#26 0x00007ffff7222795 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#27 0x00007ffff7228727 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#28 0x00007ffff64fa280 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#29 0x00007ffff7226ee5 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) ()
   from /usr/lib/libQt5Widgets.so.5
#30 0x00007ffff72812c3 in ?? () from /usr/lib/libQt5Widgets.so.5
#31 0x00007ffff7283793 in ?? () from /usr/lib/libQt5Widgets.so.5
#32 0x00007ffff72227bc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#33 0x00007ffff722795f in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#34 0x00007ffff64fa280 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#35 0x00007ffff6a46693 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/libQt5Gui.so.5
#36 0x00007ffff6a47ea5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/libQt5Gui.so.5
#37 0x00007ffff6a2518b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Gui.so.5
#38 0x00007fffecd8c080 in ?? () from /usr/lib/libQt5XcbQpa.so.5
#39 0x00007ffff4cecdd7 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#40 0x00007ffff4ced040 in ?? () from /usr/lib/libglib-2.0.so.0
#41 0x00007ffff4ced0ec in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#42 0x00007ffff65506cf in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#43 0x00007ffff64f846a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#44 0x00007ffff6500a0c in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
#45 0x00000000004caac6 in main (argc=1, argv=0x7fffffffe428) at /home/wuzzy/src/tbe/tbe/src/main.cpp:290
kaa-ching commented 8 years ago

OK, I see it now, did something wrong.

kaa-ching commented 8 years ago
=================================================================
==27993==ERROR: AddressSanitizer: heap-use-after-free on address 0x6030004a05f0 at pc 0x0000005cd04b bp 0x7fff0b946900 sp 0x7fff0b9468f8
READ of size 4 at 0x6030004a05f0 thread T0
    #0 0x5cd04a in int QGenericAtomicOps<QBasicAtomicOps<4> >::load<int>(int const&) /usr/include/qt5/QtCore/qgenericatomic.h:90:16
    #1 0x5cd04a in QBasicAtomicInteger<int>::load() const /usr/include/qt5/QtCore/qbasicatomic.h:118
    #2 0x5cfcb5 in QtPrivate::RefCount::ref() /usr/include/qt5/QtCore/qrefcount.h:49:21
    #3 0x5cf0c4 in QList<QGraphicsItem*>::QList(QList<QGraphicsItem*> const&) /usr/include/qt5/QtCore/qlist.h:778:10
    #4 0x5c9634 in QForeachContainer<QList<QGraphicsItem*> >::QForeachContainer(QList<QGraphicsItem*> const&) /usr/include/qt5/QtCore/qglobal.h:891:44
    #5 0x5c2856 in AbstractUndoCommand::isViewObjectColliding() /home/klaas/Programming/tbe-github/src/control/AbstractUndoCommand.cpp:87:5
    #6 0x5c036d in AbstractUndoCommand::setDecoratorStateUndoRedo() /home/klaas/Programming/tbe-github/src/control/AbstractUndoCommand.cpp:170:10
    #7 0x5bfdd0 in AbstractUndoCommand::~AbstractUndoCommand() /home/klaas/Programming/tbe-github/src/control/AbstractUndoCommand.cpp:49:9

0x6030004a05f0 is located 0 bytes inside of 32-byte region [0x6030004a05f0,0x6030004a0610)
freed by thread T0 here:
    #0 0x593deb in free /home/abuild/rpmbuild/BUILD/llvm-3.7.0.src/stage2/../projects/compiler-rt/lib/asan/asan_malloc_linux.cc:30:3
    #1 0x5ccf3e in QTypedArrayData<unsigned short>::deallocate(QArrayData*) /usr/include/qt5/QtCore/qarraydata.h:222:9
    #2 0x5c8e37 in QString::~QString() /usr/include/qt5/QtCore/qstring.h:1053:51
    #3 0x6a2a62 in QMapNode<QString, QString>::destroySubTree() /usr/include/qt5/QtCore/qmap.h:260:9
    #4 0x6a2c0d in QMapNode<QString, QString>::destroySubTree() /usr/include/qt5/QtCore/qmap.h:263:13
    #5 0x6a26ba in QMapData<QString, QString>::destroy() /usr/include/qt5/QtCore/qmap.h:222:13
    #6 0x6a0b96 in QMap<QString, QString>::~QMap() /usr/include/qt5/QtCore/qmap.h:339:43
    #7 0x6e2b7d in PropertyList::~PropertyList() /home/klaas/Programming/tbe-github/src/model/Property.h:42:28
    #8 0x6ce015 in AbstractObject::~AbstractObject() /home/klaas/Programming/tbe-github/src/model/AbstractObject.cpp:98:1
    #9 0x7c81b8 in RectObject::~RectObject() /home/klaas/Programming/tbe-github/src/model/RectObject.cpp:135:1
    #10 0x7c82da in RectObject::~RectObject() /home/klaas/Programming/tbe-github/src/model/RectObject.cpp:134:1

That helps a bit. Let me think...