svenvvv / rcss-sprite-ed

RmlUI RCSS spritesheet editor
GNU General Public License v3.0
8 stars 0 forks source link

SIGSEGV at image load #12

Closed svenvvv closed 3 years ago

svenvvv commented 3 years ago

Maybe related to PIL, since I never had one before f3422d719899020adffa859575f227822b9443b0.

Can reproduce by loading a multi-spritesheet document and rapidly changing spritesheets (which causes image loads in background, as we don't cache the loaded images).

Thread 1 "python" received signal SIGSEGV, Segmentation fault.
0x00007ffff7b73738 in __memmove_avx_unaligned_erms () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff7b73738 in __memmove_avx_unaligned_erms () at /usr/lib/libc.so.6
#1  0x00007ffff657cd2b in  () at /usr/lib/libQt5Gui.so.5
#2  0x00007ffff6584fa2 in QRasterPaintEngine::drawImage(QPointF const&, QImage const&) () at /usr/lib/libQt5Gui.so.5
#3  0x00007ffff1214518 in QGraphicsPixmapItem::paint(QPainter*, QStyleOptionGraphicsItem const*, QWidget*) () at /usr/lib/libQt5Widgets.so.5
#4  0x00007ffff124a2c4 in  () at /usr/lib/libQt5Widgets.so.5
#5  0x00007ffff124b2b3 in  () at /usr/lib/libQt5Widgets.so.5
#6  0x00007ffff124b93a in  () at /usr/lib/libQt5Widgets.so.5
#7  0x00007ffff1270796 in QGraphicsView::paintEvent(QPaintEvent*) () at /usr/lib/libQt5Widgets.so.5
#8  0x00007ffff0f3c0be in QWidget::event(QEvent*) () at /usr/lib/libQt5Widgets.so.5
#9  0x00007ffff0feb84f in QFrame::event(QEvent*) () at /usr/lib/libQt5Widgets.so.5
#10 0x00007ffff5ee9d62 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#11 0x00007ffff0ef8d51 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#12 0x00007ffff5eea00a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#13 0x00007ffff0f33cf8 in QWidgetPrivate::sendPaintEvent(QRegion const&) () at /usr/lib/libQt5Widgets.so.5
#14 0x00007ffff0f3455c in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter*, QWidgetRepaintManager*) () at /usr/lib/libQt5Widgets.so.5
#15 0x00007ffff0f0a278 in  () at /usr/lib/libQt5Widgets.so.5
#16 0x00007ffff0f3c829 in QWidget::event(QEvent*) () at /usr/lib/libQt5Widgets.so.5
#17 0x00007ffff0ef8d62 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#18 0x00007ffff5eea00a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#19 0x00007ffff5eed109 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/libQt5Core.so.5
#20 0x00007ffff123c7e7 in  () at /usr/lib/libQt5Widgets.so.5
#21 0x00007ffff5f1715f in QObject::event(QEvent*) () at /usr/lib/libQt5Core.so.5
#22 0x00007ffff0ef8d62 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#23 0x00007ffff5eea00a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#24 0x00007ffff5eed109 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/libQt5Core.so.5
#25 0x00007ffff5f43604 in  () at /usr/lib/libQt5Core.so.5
#26 0x00007ffff4dcd02c in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#27 0x00007ffff4e20b59 in  () at /usr/lib/libglib-2.0.so.0
#28 0x00007ffff4dca781 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#29 0x00007ffff5f42c36 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#30 0x00007ffff5ee897c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#31 0x00007ffff5ef0ee4 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#32 0x00007ffff161ac67 in  () at /usr/lib/python3.9/site-packages/PySide2/QtWidgets.cpython-39-x86_64-linux-gnu.so
#33 0x00007ffff7c46ebf in  () at /usr/lib/libpython3.9.so.1.0
#34 0x00007ffff7d07e67 in _PyEval_EvalFrameDefault () at /usr/lib/libpython3.9.so.1.0
#35 0x00007ffff7d02219 in  () at /usr/lib/libpython3.9.so.1.0
#36 0x00007ffff7d01c01 in _PyEval_EvalCodeWithName () at /usr/lib/libpython3.9.so.1.0
#37 0x00007ffff7db8d63 in PyEval_EvalCode () at /usr/lib/libpython3.9.so.1.0
#38 0x00007ffff7dc8b94 in  () at /usr/lib/libpython3.9.so.1.0
#39 0x00007ffff7dc483b in  () at /usr/lib/libpython3.9.so.1.0
#40 0x00007ffff7c7325e in  () at /usr/lib/libpython3.9.so.1.0
#41 0x00007ffff7c72644 in PyRun_SimpleFileExFlags () at /usr/lib/libpython3.9.so.1.0
#42 0x00007ffff7dda695 in Py_RunMain () at /usr/lib/libpython3.9.so.1.0
#43 0x00007ffff7dab349 in Py_BytesMain () at /usr/lib/libpython3.9.so.1.0
#44 0x00007ffff7a37b25 in __libc_start_main () at /usr/lib/libc.so.6
#45 0x000055555555504e in _start ()
svenvvv commented 3 years ago

github closes issues when I write "does not fix NN" into the commit message))

svenvvv commented 3 years ago

Could not reproduce any segfaults with QImageReader. Currently PackerWindow (or rather PyTexturePacker) still uses PIL for image loading and thus can fault.

svenvvv commented 3 years ago

A bit stumped on how to fix it. Either fork PyTexturePacker or write our own. Probably going to fork.

svenvvv commented 3 years ago

Replaced PIL with a custom QImage based wrapper that implements the minimal PIL.Image functionality required by PyTexturePacker. Could revisit in the future when I have the will to compile Qt with debugging symbols and figure out the root cause of it :)