Bug 333326

Summary: crash while saving if there's a File layer pointing to a file that doesn't exist
Product: [Applications] krita Reporter: Michele Carbone <thinkinmonkey>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: halla
Priority: NOR    
Version: 2.8.1   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Michele Carbone 2014-04-11 15:20:17 UTC
Hello,
just found this.

The krita image has various layers, both raster and vector type, and also a File layer pointing to a file.
I could open that krita image, I could draw on it, but when I tried to save it as a new image (just for backup reason), Krita crashed!
I tried both 32 bit and 64 bit version with the same file, same behaviour. Delete krita user folder, delete every temporary file, but Krita crashed. I tried also Xubuntu other than Windows, same result.
Then I discovered I moved the file pointed by the File layer in another location without updating the File layer, so I put that file in the right location known by krita and now krita is working with no crashing.
Please have a look about that.
Thank you very much.

Reproducible: Always

Steps to Reproduce:
1.Create a new document with a file layer pointing to a file. Save and close
2.Move that file in another location
3.Load the document and save the document with a new name
Actual Results:  
Krita crashed

Expected Results:  
Krita should save the image with the new name

I'm working on a netbook, but I don't think that's the problem, it's about Krita expects to find the file in the right position as enstablished by the file layer.
Comment 1 Halla Rempt 2014-04-28 15:00:12 UTC
Thread 1 (Thread 0x7f080b846880 (LWP 18662)):
[KCrash Handler]
#5  0x00007f0802e23849 in raise () from /lib64/libc.so.6
#6  0x00007f0802e24cd8 in abort () from /lib64/libc.so.6
#7  0x00007f0803eac204 in qt_message_output (msgType=msgType@entry=QtFatalMsg, buf=<optimized out>) at global/qglobal.cpp:2323
#8  0x00007f0803eac389 in qt_message(QtMsgType, const char *, typedef __va_list_tag __va_list_tag *) (msgType=msgType@entry=QtFatalMsg, msg=msg@entry=0x7f0804017518 "ASSERT: \"%s\" in file %s, line %d", ap=ap@entry=0x7fff13d580f8) at global/qglobal.cpp:2369
#9  0x00007f0803eacb94 in qFatal (msg=msg@entry=0x7f0804017518 "ASSERT: \"%s\" in file %s, line %d") at global/qglobal.cpp:2552
#10 0x00007f0803eacbda in qt_assert (assertion=assertion@entry=0x7f080b13b537 "d", file=file@entry=0x7f080b1184d8 "/home/boud/kde/src/calligra/krita/image/kis_shared_ptr.h", line=line@entry=178) at global/qglobal.cpp:2018
#11 0x00007f080aedaff2 in operator-> (this=0x4387f20) at /home/boud/kde/src/calligra/krita/image/kis_shared_ptr.h:178
#12 KisFileLayer::colorSpace (this=0x4387ed0) at /home/boud/kde/src/calligra/krita/ui/kis_file_layer.cpp:67
#13 0x00007f080a8fd776 in KisLayer::setChannelFlags (this=0x4387ed0, channelFlags=...) at /home/boud/kde/src/calligra/krita/image/kis_layer.cc:205
#14 0x00007f080afe396a in KisKraLoader::loadNode (this=this@entry=0x4327720, element=..., image=..., parent=...) at /home/boud/kde/src/calligra/krita/ui/kra/kis_kra_loader.cpp:518
#15 0x00007f080afe6cb2 in KisKraLoader::loadNodes (this=this@entry=0x4327720, element=..., image=..., parent=...) at /home/boud/kde/src/calligra/krita/ui/kra/kis_kra_loader.cpp:388
#16 0x00007f080afe7d4d in KisKraLoader::loadXML (this=0x4327720, element=...) at /home/boud/kde/src/calligra/krita/ui/kra/kis_kra_loader.cpp:252
#17 0x00007f080aed0824 in KisDoc2::loadXML (this=0x33281b0, doc=..., store=<optimized out>) at /home/boud/kde/src/calligra/krita/ui/kis_doc2.cc:312
#18 0x00007f080a3dbf04 in KoDocument::loadNativeFormatFromStoreInternal (this=this@entry=0x33281b0, store=store@entry=0x439a740) at /home/boud/kde/src/calligra/libs/main/KoDocument.cpp:1872
#19 0x00007f080a3dcce5 in KoDocument::loadNativeFormatFromStore (this=this@entry=0x33281b0, file=...) at /home/boud/kde/src/calligra/libs/main/KoDocument.cpp:1809
#20 0x00007f080a3dd236 in KoDocument::loadNativeFormat (this=0x33281b0, file_=...) at /home/boud/kde/src/calligra/libs/main/KoDocument.cpp:1789
#21 0x00007f080a3d7838 in KoDocument::openFile (this=0x33281b0) at /home/boud/kde/src/calligra/libs/main/KoDocument.cpp:1588
#22 0x00007f080a3ddf6b in openFile (this=0x3e938f0) at /home/boud/kde/src/calligra/libs/main/KoDocument.cpp:276
#23 openLocalFile (this=0x3e938f0) at /home/boud/kde/src/calligra/libs/main/KoDocument.cpp:298
#24 KoDocument::openUrlInternal (this=this@entry=0x33281b0, url=...) at /home/boud/kde/src/calligra/libs/main/KoDocument.cpp:2698
#25 0x00007f080a3de358 in KoDocument::openUrl (this=0x33281b0, _url=...) at /home/boud/kde/src/calligra/libs/main/KoDocument.cpp:1261
#26 0x00007f080a3ff4cc in KoMainWindow::openDocumentInternal (this=this@entry=0x3f0cee0, url=..., newpart=newpart@entry=0x2bfaad0, newdoc=newdoc@entry=0x33281b0) at /home/boud/kde/src/calligra/libs/main/KoMainWindow.cpp:791
#27 0x00007f080a3ff881 in KoMainWindow::openDocument (this=this@entry=0x3f0cee0, newPart=0x2bfaad0, url=...) at /home/boud/kde/src/calligra/libs/main/KoMainWindow.cpp:770
#28 0x00007f080a3c87ed in KoApplication::start (this=this@entry=0x7fff13d5a680) at /home/boud/kde/src/calligra/libs/main/KoApplication.cpp:538
#29 0x00007f080b442dcb in kdemain (argc=<optimized out>, argv=<optimized out>) at /home/boud/kde/src/calligra/krita/main.cc:103
#30 0x00007f0802e0fbe5 in __libc_start_main () from /lib64/libc.so.6
#31 0x00000000004009e1 in _start () at ../sysdeps/x86_64/start.S:122
Comment 2 Dmitry Kazakov 2014-05-05 13:44:09 UTC
Git commit 4b96de279603d93edf8d9a76cd433898c21a201a by Dmitry Kazakov.
Committed on 05/05/2014 at 13:43.
Pushed by dkazakov into branch 'master'.

Ask user for a file when a File Layer doesn't exist

TODO: we need to be able to check whether we are running inside
      of a calligraconverter or in a gui mode. Firing up message boxes
      might not be the best idea for a calligraconverter :(
CCMAIL:kimageshop@kde.org

M  +1    -1    krita/ui/kis_doc2.cc
M  +7    -0    krita/ui/kis_file_layer.cpp
M  +37   -1    krita/ui/kra/kis_kra_loader.cpp

http://commits.kde.org/calligra/4b96de279603d93edf8d9a76cd433898c21a201a
Comment 3 Michele Carbone 2014-05-07 11:49:54 UTC
Thank you very much, guys