Bug 328895

Summary: Try to save multi-layer image as psd
Product: krita Reporter: Halla Rempt <halla>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash Keywords: drkonqi
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE RPMs   
OS: Linux   
Latest Commit: Version Fixed In:

Description Halla Rempt 2013-12-17 08:46:53 UTC
Application: krita (2.8 Beta 1)
KDE Platform Version: 4.11.2
Qt Version: 4.8.5
Operating System: Linux 3.11.6-4-desktop x86_64
Distribution: "openSUSE 13.1 (Bottle) (x86_64)"

-- Information about the crash:
The image was in RGB format and had five layers, four of which were empty.

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

Thread 8 (Thread 0x7fa30814f700 (LWP 10577)):
#0  0x00007fa32ac0f0af in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007fa32aea2b66 in wait (time=18446744073709551615, this=0x2a4e7f0) at thread/qwaitcondition_unix.cpp:86
#2  QWaitCondition::wait (this=<optimized out>, mutex=mutex@entry=0x2a4e780, time=time@entry=18446744073709551615) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fa32ae9ecfb in QSemaphore::acquire (this=this@entry=0x2a4e4a0, n=n@entry=1) at thread/qsemaphore.cpp:144
#4  0x00007fa33176eddc in waitForWork (this=0x2a4e490) at /home/boud/kde/src/calligra/krita/image/tiles3/kis_tile_data_pooler.cc:162
#5  KisTileDataPooler::run (this=0x2a4e490) at /home/boud/kde/src/calligra/krita/image/tiles3/kis_tile_data_pooler.cc:184
#6  0x00007fa32aea268f in QThreadPrivate::start (arg=0x2a4e490) at thread/qthread_unix.cpp:338
#7  0x00007fa32ac0b0db in start_thread () from /lib64/libpthread.so.0
#8  0x00007fa329ec190d in clone () from /lib64/libc.so.6

Thread 7 (Thread 0x7fa30794e700 (LWP 10578)):
#0  0x00007fa32ac0f0af in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007fa32aea2b66 in wait (time=18446744073709551615, this=0x2a1b0c0) at thread/qwaitcondition_unix.cpp:86
#2  QWaitCondition::wait (this=<optimized out>, mutex=mutex@entry=0x2a1b090, time=time@entry=18446744073709551615) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fa32ae9f103 in QSemaphore::tryAcquire (this=0x2a1b040, n=n@entry=1, timeout=timeout@entry=-1) at thread/qsemaphore.cpp:221
#4  0x00007fa33179c533 in KisTileDataSwapper::waitForWork (this=this@entry=0x2a4e4c8) at /home/boud/kde/src/calligra/krita/image/tiles3/swap/kis_tile_data_swapper.cpp:86
#5  0x00007fa33179c75a in KisTileDataSwapper::run (this=0x2a4e4c8) at /home/boud/kde/src/calligra/krita/image/tiles3/swap/kis_tile_data_swapper.cpp:92
#6  0x00007fa32aea268f in QThreadPrivate::start (arg=0x2a4e4c8) at thread/qthread_unix.cpp:338
#7  0x00007fa32ac0b0db in start_thread () from /lib64/libpthread.so.0
#8  0x00007fa329ec190d in clone () from /lib64/libc.so.6

Thread 6 (Thread 0x7fa306273700 (LWP 10585)):
#0  0x00007fa329eba913 in select () from /lib64/libc.so.6
#1  0x00007fa32afcc6fb in qt_safe_select (nfds=23, fdread=0x45068c8, fdwrite=0x4506b60, fdexcept=0x4506df8, orig_timeout=0x0) at kernel/qcore_unix.cpp:83
#2  0x00007fa32afd2374 in QEventDispatcherUNIXPrivate::doSelect (this=this@entry=0x4506710, flags=..., timeout=0x0) at kernel/qeventdispatcher_unix.cpp:223
#3  0x00007fa32afd27d2 in QEventDispatcherUNIX::processEvents (this=0x450d1c0, flags=...) at kernel/qeventdispatcher_unix.cpp:951
#4  0x00007fa32afa0d0f in QEventLoop::processEvents (this=this@entry=0x7fa306272d20, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007fa32afa1005 in QEventLoop::exec (this=this@entry=0x7fa306272d20, flags=...) at kernel/qeventloop.cpp:204
#6  0x00007fa32ae9ffef in QThread::exec (this=this@entry=0x4505240) at thread/qthread.cpp:536
#7  0x00007fa32af82513 in QInotifyFileSystemWatcherEngine::run (this=0x4505240) at io/qfilesystemwatcher_inotify.cpp:256
#8  0x00007fa32aea268f in QThreadPrivate::start (arg=0x4505240) at thread/qthread_unix.cpp:338
#9  0x00007fa32ac0b0db in start_thread () from /lib64/libpthread.so.0
#10 0x00007fa329ec190d in clone () from /lib64/libc.so.6

Thread 5 (Thread 0x7fa2f8b10700 (LWP 10598)):
#0  0x00007fa32ac0f0af in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007fa32aea2b66 in wait (time=18446744073709551615, this=0x5648bc0) at thread/qwaitcondition_unix.cpp:86
#2  QWaitCondition::wait (this=this@entry=0x56486e8, mutex=mutex@entry=0x56486e0, time=time@entry=18446744073709551615) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fa32c107ac6 in QFileInfoGatherer::run (this=0x56486d0) at dialogs/qfileinfogatherer.cpp:214
#4  0x00007fa32aea268f in QThreadPrivate::start (arg=0x56486d0) at thread/qthread_unix.cpp:338
#5  0x00007fa32ac0b0db in start_thread () from /lib64/libpthread.so.0
#6  0x00007fa329ec190d in clone () from /lib64/libc.so.6

Thread 4 (Thread 0x7fa2f830f700 (LWP 10599)):
#0  0x00007fa329eba913 in select () from /lib64/libc.so.6
#1  0x00007fa32afcc6fb in qt_safe_select (nfds=40, fdread=0x5652228, fdwrite=0x56524c0, fdexcept=0x5652758, orig_timeout=0x0) at kernel/qcore_unix.cpp:83
#2  0x00007fa32afd2374 in QEventDispatcherUNIXPrivate::doSelect (this=this@entry=0x5652070, flags=..., timeout=0x0) at kernel/qeventdispatcher_unix.cpp:223
#3  0x00007fa32afd27d2 in QEventDispatcherUNIX::processEvents (this=0x4276310, flags=...) at kernel/qeventdispatcher_unix.cpp:951
#4  0x00007fa32afa0d0f in QEventLoop::processEvents (this=this@entry=0x7fa2f830ed20, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007fa32afa1005 in QEventLoop::exec (this=this@entry=0x7fa2f830ed20, flags=...) at kernel/qeventloop.cpp:204
#6  0x00007fa32ae9ffef in QThread::exec (this=this@entry=0x5648d80) at thread/qthread.cpp:536
#7  0x00007fa32af82513 in QInotifyFileSystemWatcherEngine::run (this=0x5648d80) at io/qfilesystemwatcher_inotify.cpp:256
#8  0x00007fa32aea268f in QThreadPrivate::start (arg=0x5648d80) at thread/qthread_unix.cpp:338
#9  0x00007fa32ac0b0db in start_thread () from /lib64/libpthread.so.0
#10 0x00007fa329ec190d in clone () from /lib64/libc.so.6

Thread 3 (Thread 0x7fa2f35ca700 (LWP 10678)):
#0  0x00007fa329eba913 in select () from /lib64/libc.so.6
#1  0x00007fa32afcc6fb in qt_safe_select (nfds=50, fdread=0x9400978, fdwrite=0x9400c10, fdexcept=0x9400ea8, orig_timeout=0x0) at kernel/qcore_unix.cpp:83
#2  0x00007fa32afd2374 in QEventDispatcherUNIXPrivate::doSelect (this=this@entry=0x94007c0, flags=..., timeout=0x0) at kernel/qeventdispatcher_unix.cpp:223
#3  0x00007fa32afd27d2 in QEventDispatcherUNIX::processEvents (this=0x73f3c60, flags=...) at kernel/qeventdispatcher_unix.cpp:951
#4  0x00007fa32afa0d0f in QEventLoop::processEvents (this=this@entry=0x7fa2f35c9d20, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007fa32afa1005 in QEventLoop::exec (this=this@entry=0x7fa2f35c9d20, flags=...) at kernel/qeventloop.cpp:204
#6  0x00007fa32ae9ffef in QThread::exec (this=this@entry=0x93fd4d0) at thread/qthread.cpp:536
#7  0x00007fa32af82513 in QInotifyFileSystemWatcherEngine::run (this=0x93fd4d0) at io/qfilesystemwatcher_inotify.cpp:256
#8  0x00007fa32aea268f in QThreadPrivate::start (arg=0x93fd4d0) at thread/qthread_unix.cpp:338
#9  0x00007fa32ac0b0db in start_thread () from /lib64/libpthread.so.0
#10 0x00007fa329ec190d in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7fa2f2dc9700 (LWP 10681)):
#0  0x00007fa329eba913 in select () from /lib64/libc.so.6
#1  0x00007fa32af7f261 in QProcessManager::run (this=0x7fa32b308520 <processManager()::processManager>) at io/qprocess_unix.cpp:247
#2  0x00007fa32aea268f in QThreadPrivate::start (arg=0x7fa32b308520 <processManager()::processManager>) at thread/qthread_unix.cpp:338
#3  0x00007fa32ac0b0db in start_thread () from /lib64/libpthread.so.0
#4  0x00007fa329ec190d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7fa332c08880 (LWP 10576)):
[KCrash Handler]
#6  0x00007fa329e0f849 in raise () from /lib64/libc.so.6
#7  0x00007fa329e10cd8 in abort () from /lib64/libc.so.6
#8  0x00007fa32ae98204 in qt_message_output (msgType=msgType@entry=QtFatalMsg, buf=<optimized out>) at global/qglobal.cpp:2323
#9  0x00007fa32ae98389 in qt_message(QtMsgType, const char *, typedef __va_list_tag __va_list_tag *) (msgType=msgType@entry=QtFatalMsg, msg=msg@entry=0x7fa32b003518 "ASSERT: \"%s\" in file %s, line %d", ap=ap@entry=0x7fff8bb8ef18) at global/qglobal.cpp:2369
#10 0x00007fa32ae98b94 in qFatal (msg=msg@entry=0x7fa32b003518 "ASSERT: \"%s\" in file %s, line %d") at global/qglobal.cpp:2552
#11 0x00007fa32ae98bda in qt_assert (assertion=assertion@entry=0x7fa2f1bbf7b8 "left <= right", file=file@entry=0x7fa2f1bbfe68 "/home/boud/kde/src/calligra/krita/plugins/formats/psd/psd_layer_record.cpp", line=line@entry=530) at global/qglobal.cpp:2018
#12 0x00007fa2f1ba69cd in PSDLayerRecord::write (this=this@entry=0x947bec0, io=io@entry=0x7fff8bb8f200, node=...) at /home/boud/kde/src/calligra/krita/plugins/formats/psd/psd_layer_record.cpp:530
#13 0x00007fa2f1ba253a in PSDLayerSection::write (this=this@entry=0x7fff8bb8f280, io=io@entry=0x7fff8bb8f200, rootLayer=...) at /home/boud/kde/src/calligra/krita/plugins/formats/psd/psd_layer_section.cpp:338
#14 0x00007fa2f1b95017 in PSDSaver::buildFile (this=this@entry=0x7fff8bb8f3a0, uri=...) at /home/boud/kde/src/calligra/krita/plugins/formats/psd/psd_saver.cpp:195
#15 0x00007fa2f1b926d1 in psdExport::convert (this=<optimized out>, from=..., to=...) at /home/boud/kde/src/calligra/krita/plugins/formats/psd/psd_export.cc:89
#16 0x00007fa33143150f in CalligraFilter::ChainLink::invokeFilter (this=0x5124a00, parentChainLink=parentChainLink@entry=0x0) at /home/boud/kde/src/calligra/libs/main/KoFilterChainLink.cpp:90
#17 0x00007fa331428702 in KoFilterChain::invokeChain (this=0x953a560) at /home/boud/kde/src/calligra/libs/main/KoFilterChain.cpp:95
#18 0x00007fa331423876 in KoFilterManager::exportDocument (this=0x8eba160, url=..., mimeType=...) at /home/boud/kde/src/calligra/libs/main/KoFilterManager.cpp:243
#19 0x00007fa3313aaeee in KoDocument::saveFile (this=0x3c85e50) at /home/boud/kde/src/calligra/libs/main/KoDocument.cpp:587
#20 0x00007fa3313b5e4d in KoDocument::save (this=0x3c85e50) at /home/boud/kde/src/calligra/libs/main/KoDocument.cpp:2512
#21 0x00007fa3313b796f in KoDocument::saveAs (this=0x3c85e50, kurl=...) at /home/boud/kde/src/calligra/libs/main/KoDocument.cpp:2478
#22 0x00007fa3313dd2b8 in KoMainWindow::saveDocument (this=this@entry=0x242f390, saveas=<optimized out>, saveas@entry=true, silent=silent@entry=false, specialOutputFlag=specialOutputFlag@entry=0) at /home/boud/kde/src/calligra/libs/main/KoMainWindow.cpp:1071
#23 0x00007fa3313de6d2 in KoMainWindow::slotFileSaveAs (this=this@entry=0x242f390) at /home/boud/kde/src/calligra/libs/main/KoMainWindow.cpp:1341
#24 0x00007fa3313ea3cd in KoMainWindow::qt_static_metacall (_o=0x242f390, _c=<optimized out>, _id=9, _a=0x7fff8bb900c0) at /home/boud/kde/build/calligra/libs/main/KoMainWindow.moc:134
#25 0x00007fa32afb5d68 in QMetaObject::activate (sender=sender@entry=0x3e7e0e0, m=m@entry=0x7fa32c6d12a0 <QAction::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x7fff8bb900c0) at kernel/qobject.cpp:3556
#26 0x00007fa32bc29752 in QAction::triggered (this=this@entry=0x3e7e0e0, _t1=false) at .moc/release-shared/moc_qaction.cpp:276
#27 0x00007fa32bc2b123 in QAction::activate (this=this@entry=0x3e7e0e0, event=event@entry=QAction::Trigger) at kernel/qaction.cpp:1257
#28 0x00007fa32c0540e9 in QMenuPrivate::activateCausedStack (this=this@entry=0x4086090, causedStack=..., action=action@entry=0x3e7e0e0, action_e=action_e@entry=QAction::Trigger, self=self@entry=true) at widgets/qmenu.cpp:1038
#29 0x00007fa32c058619 in QMenuPrivate::activateAction (this=0x4086090, action=0x3e7e0e0, action_e=QAction::Trigger, self=<optimized out>) at widgets/qmenu.cpp:1130
#30 0x00007fa32c05a8a7 in QMenu::keyPressEvent (this=this@entry=0x4067c50, e=e@entry=0x7fff8bb90750) at widgets/qmenu.cpp:2826
#31 0x00007fa32c9fc3f0 in KMenu::keyPressEvent (this=0x4067c50, e=0x7fff8bb90750) at /usr/src/debug/kdelibs-4.11.2/kdeui/widgets/kmenu.cpp:224
#32 0x00007fa32bc7ecca in QWidget::event (this=this@entry=0x4067c50, event=event@entry=0x7fff8bb90750) at kernel/qwidget.cpp:8422
#33 0x00007fa32c05c3eb in QMenu::event (this=0x4067c50, e=0x7fff8bb90750) at widgets/qmenu.cpp:2481
#34 0x00007fa32bc2f8ac in QApplicationPrivate::notify_helper (this=this@entry=0x220d280, receiver=receiver@entry=0x4067c50, e=e@entry=0x7fff8bb90750) at kernel/qapplication.cpp:4562
#35 0x00007fa32bc370c1 in QApplication::notify (this=<optimized out>, receiver=receiver@entry=0x4067c50, e=e@entry=0x7fff8bb90750) at kernel/qapplication.cpp:4003
#36 0x00007fa3313a4a47 in KoApplication::notify (this=<optimized out>, receiver=0x4067c50, event=0x7fff8bb90750) at /home/boud/kde/src/calligra/libs/main/KoApplication.cpp:549
#37 0x00007fa32afa20ad in QCoreApplication::notifyInternal (this=0x7fff8bb90fc0, receiver=receiver@entry=0x4067c50, event=event@entry=0x7fff8bb90750) at kernel/qcoreapplication.cpp:949
#38 0x00007fa32bc2e246 in sendSpontaneousEvent (event=event@entry=0x7fff8bb90750, receiver=receiver@entry=0x4067c50) at ../../src/corelib/kernel/qcoreapplication.h:234
#39 qt_sendSpontaneousEvent (receiver=receiver@entry=0x4067c50, event=event@entry=0x7fff8bb90750) at kernel/qapplication.cpp:5560
#40 0x00007fa32bcc9d79 in QKeyMapper::sendKeyEvent (keyWidget=keyWidget@entry=0x4067c50, grab=grab@entry=false, type=QEvent::KeyPress, code=65, modifiers=..., text=..., autorepeat=autorepeat@entry=false, count=1, nativeScanCode=38, nativeVirtualKey=97, nativeModifiers=0) at kernel/qkeymapper_x11.cpp:1866
#41 0x00007fa32bcca119 in QKeyMapperPrivate::translateKeyEvent (this=0x22758d0, keyWidget=keyWidget@entry=0x4067c50, event=event@entry=0x7fff8bb90ce0, grab=grab@entry=false) at kernel/qkeymapper_x11.cpp:1836
#42 0x00007fa32bca5d3f in QApplication::x11ProcessEvent (this=0x7fff8bb90fc0, event=event@entry=0x7fff8bb90ce0) at kernel/qapplication_x11.cpp:3544
#43 0x00007fa32bccd1f0 in QEventDispatcherX11::processEvents (this=0x2164880, flags=...) at kernel/qeventdispatcher_x11.cpp:132
#44 0x00007fa32afa0d0f in QEventLoop::processEvents (this=this@entry=0x7fff8bb90f40, flags=...) at kernel/qeventloop.cpp:149
#45 0x00007fa32afa1005 in QEventLoop::exec (this=this@entry=0x7fff8bb90f40, flags=...) at kernel/qeventloop.cpp:204
#46 0x00007fa32afa613b in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1221
#47 0x00007fa32bc2e06c in QApplication::exec () at kernel/qapplication.cpp:3823
#48 0x00007fa3325e3b45 in kdemain (argc=<optimized out>, argv=<optimized out>) at /home/boud/kde/src/calligra/krita/main.cc:99
#49 0x00007fa329dfbbe5 in __libc_start_main () from /lib64/libc.so.6
#50 0x00000000004009f1 in _start () at ../sysdeps/x86_64/start.S:122

Reported using DrKonqi
Comment 1 Halla Rempt 2013-12-18 12:12:10 UTC
So an empty layer on conversion gets these bounds:

QRect(2147483584,2147483584 64x64)

That's bound to give trouble
Comment 2 Halla Rempt 2013-12-18 12:25:41 UTC
Git commit 414d004a77f06d4c2fca26bcf12012c277093ce1 by Boudewijn Rempt.
Committed on 18/12/2013 at 12:24.
Pushed by rempt into branch 'calligra/2.8'.

Do not convert empty paint devices, but convert their default pixel

M  +28   -19   krita/image/kis_paint_device.cc

http://commits.kde.org/calligra/414d004a77f06d4c2fca26bcf12012c277093ce1
Comment 3 Halla Rempt 2013-12-18 12:25:49 UTC
Git commit cdcca6c541af495a12cbaccdd3436bdb8c44bef2 by Boudewijn Rempt.
Committed on 18/12/2013 at 12:24.
Pushed by rempt into branch 'master'.

Do not convert empty paint devices, but convert their default pixel

M  +28   -19   krita/image/kis_paint_device.cc

http://commits.kde.org/calligra/cdcca6c541af495a12cbaccdd3436bdb8c44bef2