Bug 318759 - krita crashes when loading a .kra with a mask
Summary: krita crashes when loading a .kra with a mask
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: regression, release_blocker
Depends on:
Blocks:
 
Reported: 2013-04-23 10:58 UTC by Halla Rempt
Modified: 2013-05-17 07:15 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Halla Rempt 2013-04-23 10:58:58 UTC
Application: krita (2.7 Pre-Alpha)
KDE Platform Version: 4.10.00 "release 1"
Qt Version: 4.8.4
Operating System: Linux 3.7.10-1.1-desktop x86_64
Distribution: "openSUSE 12.3 (x86_64)"

-- Information about the crash:
Create a new image, add a transparency mask with a selection. Save. Close. Load.

On loading, we first load the attributes and apply them and then the binary data. This means that the selection isn't set when we set the visibility. Setting the visibility checks whether the selection is present. It isn't, so the assert fires.

The crash can be reproduced every time.

-- Backtrace:
Application: Krita (krita), signal: Aborted
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f298f477780 (LWP 16578))]

Thread 8 (Thread 0x7f2971dde700 (LWP 16579)):
#0  0x00007f298e5bd964 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f298e85062b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib64/libQtCore.so.4
#2  0x00007f298e84c537 in QSemaphore::acquire(int) () from /usr/lib64/libQtCore.so.4
#3  0x00007f298d95e2f4 in waitForWork (this=0x3469160) at /home/boud/kde/src/calligra/krita/image/tiles3/kis_tile_data_pooler.cc:162
#4  KisTileDataPooler::run (this=0x3469160) at /home/boud/kde/src/calligra/krita/image/tiles3/kis_tile_data_pooler.cc:184
#5  0x00007f298e8500cc in ?? () from /usr/lib64/libQtCore.so.4
#6  0x00007f298e5b9e0f in start_thread () from /lib64/libpthread.so.0
#7  0x00007f2985b097dd in clone () from /lib64/libc.so.6

Thread 7 (Thread 0x7f29715dd700 (LWP 16580)):
#0  0x00007f298e5bd964 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f298e85062b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib64/libQtCore.so.4
#2  0x00007f298e84c908 in QSemaphore::tryAcquire(int, int) () from /usr/lib64/libQtCore.so.4
#3  0x00007f298d98bd3a in KisTileDataSwapper::run (this=0x3469198) at /home/boud/kde/src/calligra/krita/image/tiles3/swap/kis_tile_data_swapper.cpp:92
#4  0x00007f298e8500cc in ?? () from /usr/lib64/libQtCore.so.4
#5  0x00007f298e5b9e0f in start_thread () from /lib64/libpthread.so.0
#6  0x00007f2985b097dd in clone () from /lib64/libc.so.6

Thread 6 (Thread 0x7f296a7fc700 (LWP 16585)):
#0  0x00007f2985b02623 in select () from /lib64/libc.so.6
#1  0x00007f298e977603 in qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) () from /usr/lib64/libQtCore.so.4
#2  0x00007f298e97c099 in QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) () from /usr/lib64/libQtCore.so.4
#3  0x00007f298e97d162 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#4  0x00007f298e94a9ef in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#5  0x00007f298e94ac78 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#6  0x00007f298e84d0f0 in QThread::exec() () from /usr/lib64/libQtCore.so.4
#7  0x00007f298e92b1af in ?? () from /usr/lib64/libQtCore.so.4
#8  0x00007f298e8500cc in ?? () from /usr/lib64/libQtCore.so.4
#9  0x00007f298e5b9e0f in start_thread () from /lib64/libpthread.so.0
#10 0x00007f2985b097dd in clone () from /lib64/libc.so.6

Thread 5 (Thread 0x7f296b7fe700 (LWP 16611)):
#0  0x00007f298e5bd964 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f298e85062b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib64/libQtCore.so.4
#2  0x00007f29876514d6 in ?? () from /usr/lib64/libQtGui.so.4
#3  0x00007f298e8500cc in ?? () from /usr/lib64/libQtCore.so.4
#4  0x00007f298e5b9e0f in start_thread () from /lib64/libpthread.so.0
#5  0x00007f2985b097dd in clone () from /lib64/libc.so.6

Thread 4 (Thread 0x7f296bfff700 (LWP 16612)):
#0  0x00007f2985b02623 in select () from /lib64/libc.so.6
#1  0x00007f298e977603 in qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) () from /usr/lib64/libQtCore.so.4
#2  0x00007f298e97c099 in QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) () from /usr/lib64/libQtCore.so.4
#3  0x00007f298e97d162 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#4  0x00007f298e94a9ef in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#5  0x00007f298e94ac78 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#6  0x00007f298e84d0f0 in QThread::exec() () from /usr/lib64/libQtCore.so.4
#7  0x00007f298e92b1af in ?? () from /usr/lib64/libQtCore.so.4
#8  0x00007f298e8500cc in ?? () from /usr/lib64/libQtCore.so.4
#9  0x00007f298e5b9e0f in start_thread () from /lib64/libpthread.so.0
#10 0x00007f2985b097dd in clone () from /lib64/libc.so.6

Thread 3 (Thread 0x7f29357fa700 (LWP 16633)):
#0  0x00007f2985b02623 in select () from /lib64/libc.so.6
#1  0x00007f298e92a7e2 in ?? () from /usr/lib64/libQtCore.so.4
#2  0x00007f298e8500cc in ?? () from /usr/lib64/libQtCore.so.4
#3  0x00007f298e5b9e0f in start_thread () from /lib64/libpthread.so.0
#4  0x00007f2985b097dd in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7f296affd700 (LWP 16650)):
#0  0x00007f2985b02623 in select () from /lib64/libc.so.6
#1  0x00007f298e977603 in qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) () from /usr/lib64/libQtCore.so.4
#2  0x00007f298e97c099 in QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) () from /usr/lib64/libQtCore.so.4
#3  0x00007f298e97d162 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#4  0x00007f298e94a9ef in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#5  0x00007f298e94ac78 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#6  0x00007f298e84d0f0 in QThread::exec() () from /usr/lib64/libQtCore.so.4
#7  0x00007f298e92b1af in ?? () from /usr/lib64/libQtCore.so.4
#8  0x00007f298e8500cc in ?? () from /usr/lib64/libQtCore.so.4
#9  0x00007f298e5b9e0f in start_thread () from /lib64/libpthread.so.0
#10 0x00007f2985b097dd in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f298f477780 (LWP 16578)):
[KCrash Handler]
#5  0x00007f2985a563d5 in raise () from /lib64/libc.so.6
#6  0x00007f2985a57858 in abort () from /lib64/libc.so.6
#7  0x00007f298e845c54 in qt_message_output(QtMsgType, char const*) () from /usr/lib64/libQtCore.so.4
#8  0x00007f298e845e08 in ?? () from /usr/lib64/libQtCore.so.4
#9  0x00007f298e845f94 in qFatal(char const*, ...) () from /usr/lib64/libQtCore.so.4
#10 0x00007f298e845fda in qt_assert(char const*, char const*, int) () from /usr/lib64/libQtCore.so.4
#11 0x00007f298daad2fa in KisMask::selection (this=0x67f1750) at /home/boud/kde/src/calligra/krita/image/kis_mask.cc:145
#12 0x00007f298db105c9 in KisSelectionMask::setVisible (this=0x67f1750, visible=true) at /home/boud/kde/src/calligra/krita/image/kis_selection_mask.cpp:121
#13 0x00007f298e1ab33c in KisKraLoader::loadNode (this=this@entry=0x7c44220, element=..., image=..., parent=...) at /home/boud/kde/src/calligra/krita/ui/kra/kis_kra_loader.cpp:459
#14 0x00007f298e1ace83 in KisKraLoader::loadNodes (this=this@entry=0x7c44220, element=..., image=..., parent=...) at /home/boud/kde/src/calligra/krita/ui/kra/kis_kra_loader.cpp:351
#15 0x00007f298e1ae01d in KisKraLoader::loadXML (this=0x7c44220, element=...) at /home/boud/kde/src/calligra/krita/ui/kra/kis_kra_loader.cpp:236
#16 0x00007f298e09c98b in KisDoc2::loadXML (this=0x5898960, doc=...) at /home/boud/kde/src/calligra/krita/ui/kis_doc2.cc:271
#17 0x00007f298d57e69b in KoDocument::loadNativeFormatFromStoreInternal (this=this@entry=0x5898960, store=store@entry=0x5daffe0) at /home/boud/kde/src/calligra/libs/main/KoDocument.cpp:1587
#18 0x00007f298d57f7f0 in KoDocument::loadNativeFormatFromStore (this=this@entry=0x5898960, file=...) at /home/boud/kde/src/calligra/libs/main/KoDocument.cpp:1524
#19 0x00007f298d57fcfa in KoDocument::loadNativeFormat (this=0x5898960, file_=...) at /home/boud/kde/src/calligra/libs/main/KoDocument.cpp:1504
#20 0x00007f298d57b89d in KoDocument::openFile (this=0x5898960) at /home/boud/kde/src/calligra/libs/main/KoDocument.cpp:1310
#21 0x00007f298d62d42d in KoPart::openFile (this=0x3793800) at /home/boud/kde/src/calligra/libs/main/KoPart.cpp:199
#22 0x00007f298d0b9000 in ?? () from /usr/lib64/libkparts.so.4
#23 0x00007f298d0b95a4 in KParts::ReadOnlyPart::openUrl(KUrl const&) () from /usr/lib64/libkparts.so.4
#24 0x00007f298d578dee in KoDocument::openUrl (this=0x5898960, _url=...) at /home/boud/kde/src/calligra/libs/main/KoDocument.cpp:983
#25 0x00007f298d62cb1a in KoPart::openExistingFile (this=0x3793800, url=...) at /home/boud/kde/src/calligra/libs/main/KoPart.cpp:366
#26 0x00007f298e9611af in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#27 0x00007f298d60d499 in openExistingFile (_t1=..., this=0x4962ec0) at /home/boud/kde/build/calligra/libs/main/KoOpenPane.moc:118
#28 KoOpenPane::qt_static_metacall (_o=0x4962ec0, _id=<optimized out>, _a=0x7fffbfbe4340, _c=<optimized out>) at /home/boud/kde/build/calligra/libs/main/KoOpenPane.moc:63
#29 0x00007f298e9611af in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#30 0x00007f298d609502 in KoDetailsPane::openUrl (this=<optimized out>, _t1=...) at /home/boud/kde/build/calligra/libs/main/KoDetailsPane.moc:119
#31 0x00007f298d60f0be in KoRecentDocumentsPane::openFile (this=0x7b4b4b0, index=...) at /home/boud/kde/src/calligra/libs/main/KoRecentDocumentsPane.cpp:214
#32 0x00007f298d609359 in KoDetailsPane::qt_static_metacall (_o=0x7b4b4b0, _id=<optimized out>, _a=0x7fffbfbe4540, _c=<optimized out>) at /home/boud/kde/build/calligra/libs/main/KoDetailsPane.moc:67
#33 0x00007f298e9611af in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#34 0x00007f298766c665 in QAbstractItemView::doubleClicked(QModelIndex const&) () from /usr/lib64/libQtGui.so.4
#35 0x00007f29876b51cd in QTreeView::mouseDoubleClickEvent(QMouseEvent*) () from /usr/lib64/libQtGui.so.4
#36 0x00007f29871b5162 in QWidget::event(QEvent*) () from /usr/lib64/libQtGui.so.4
#37 0x00007f298755ff26 in QFrame::event(QEvent*) () from /usr/lib64/libQtGui.so.4
#38 0x00007f298766b81b in QAbstractItemView::viewportEvent(QEvent*) () from /usr/lib64/libQtGui.so.4
#39 0x00007f29876b00d1 in QTreeView::viewportEvent(QEvent*) () from /usr/lib64/libQtGui.so.4
#40 0x00007f298e94be06 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4
#41 0x00007f298716583c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#42 0x00007f298716a54b in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#43 0x00007f298d569ee8 in KoApplication::notify (this=<optimized out>, receiver=0x69c8610, event=0x7fffbfbe5170) at /home/boud/kde/src/calligra/libs/main/KoApplication.cpp:556
#44 0x00007f298e94bc9e in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4
#45 0x00007f29871666ab in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib64/libQtGui.so.4
#46 0x00007f29871e0e94 in ?? () from /usr/lib64/libQtGui.so.4
#47 0x00007f29871dfc21 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib64/libQtGui.so.4
#48 0x00007f29872069d9 in ?? () from /usr/lib64/libQtGui.so.4
#49 0x00007f298e94a9ef in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#50 0x00007f298e94ac78 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#51 0x00007f298e94f918 in QCoreApplication::exec() () from /usr/lib64/libQtCore.so.4
#52 0x00007f298ee91682 in kdemain (argc=<optimized out>, argv=<optimized out>) at /home/boud/kde/src/calligra/krita/main.cc:79
#53 0x00007f2985a42a15 in __libc_start_main () from /lib64/libc.so.6
#54 0x0000000000400a21 in _start () at ../sysdeps/x86_64/start.S:123

Reported using DrKonqi
Comment 1 Halla Rempt 2013-04-29 08:31:09 UTC
Git commit 3b035904cab810dff7dddffbe6621745a898f1b1 by Boudewijn Rempt.
Committed on 29/04/2013 at 10:29.
Pushed by rempt into branch 'master'.

Fix loading of images with selection masks.

Selections masks call KisMask::selection() in setVisibile, which
asserts if there initSelection() hasn't been called yet. But we cannot
call initSelection at this stage of loading because we're only creating
the node hierarchy, not the binary content yet.

So, add a flag "loading" that inhibits that call & all signal emissions.

M  +5    -3    krita/image/kis_base_node.cpp
M  +4    -1    krita/image/kis_base_node.h
M  +6    -4    krita/image/kis_selection_mask.cpp
M  +1    -1    krita/image/kis_selection_mask.h
M  +2    -2    krita/ui/flake/kis_shape_layer.cc
M  +1    -1    krita/ui/flake/kis_shape_layer.h
M  +1    -1    krita/ui/kra/kis_kra_loader.cpp

http://commits.kde.org/calligra/3b035904cab810dff7dddffbe6621745a898f1b1
Comment 2 Siddharth 2013-05-17 07:15:25 UTC
Git commit 69fc58bcc4597f725bbf76e94b9e7fd88c6b434d by Siddharth Sharma, on behalf of Boudewijn Rempt.
Committed on 29/04/2013 at 10:29.
Pushed by siddharthsharma into branch 'krita-psd-plugin-siddharth'.

Fix loading of images with selection masks.

Selections masks call KisMask::selection() in setVisibile, which
asserts if there initSelection() hasn't been called yet. But we cannot
call initSelection at this stage of loading because we're only creating
the node hierarchy, not the binary content yet.

So, add a flag "loading" that inhibits that call & all signal emissions.

M  +5    -3    krita/image/kis_base_node.cpp
M  +4    -1    krita/image/kis_base_node.h
M  +6    -4    krita/image/kis_selection_mask.cpp
M  +1    -1    krita/image/kis_selection_mask.h
M  +2    -2    krita/ui/flake/kis_shape_layer.cc
M  +1    -1    krita/ui/flake/kis_shape_layer.h
M  +1    -1    krita/ui/kra/kis_kra_loader.cpp

http://commits.kde.org/calligra/69fc58bcc4597f725bbf76e94b9e7fd88c6b434d