Bug 357987

Summary: Krita closes itself immediately after trying to load the specified file
Product: [Applications] krita Reporter: Igor S. <scorched>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: critical CC: griffinvalley, halla
Priority: NOR    
Version First Reported In: 2.9.10   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
URL: https://googledrive.com/host/0B2actlkGK6rxfmJkUVh6Q3pPaFhWOWhfTUZtUFhncThMYXVvSWc3TnMwN0lwTUxBR2wxYjA/pj_cat.kra
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: This is the file that forces Krita to quit
crashing file with generator layer removed.

Description Igor S. 2016-01-14 16:30:29 UTC
I specified the file in "URL" field that causes Krita to silently quit.
It was created in 2.9.9 git 22f7b3b, and the issue persists in 2.9.10 git 5f2f2b0.
Other .kra files are loaded fine.
It can be related to "Clone" or "Fill" layers which I used for the first time. I'd bet it has something to do with Fill one, because I remember loading the picture with Clone layers yesterday, while with the Fill layers I only saved and not loaded the picture until today.
I specified the issue as Critical, because it really causes to lose data, though in my case I fortunately made an export to one-layer .png file prior to closing Krita yesterday, and can continue work from there.

Reproducible: Always

Steps to Reproduce:
1. Download file from the URL specified
2. Run Krita, click File->Open... and select the file from previous step

Actual Results:  
Krita silently quits

Expected Results:  
I expect it to load the image so I can continue the work

Win7 64bit Home Premium, i5-3570 3.4 GHz, 8 Gb RAM, GTX660
Comment 1 Igor S. 2016-01-14 16:32:32 UTC
Created attachment 96636 [details]
This is the file that forces Krita to quit
Comment 2 wolthera 2016-01-15 14:06:05 UTC
Created attachment 96656 [details]
crashing file with generator layer removed.

Yeah, crashes for me as well:
KCrash: Attempting to start /usr/lib/x86_64-linux-gnu/libexec/drkonqi from kdeinit
sock_file=/run/user/1000/kdeinit5__0
QFile::at: Cannot set file position 165222
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 174439
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 174498
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 149526
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 156404
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 156463
QFile::at: Cannot set file position 199641
Lcms2 error:  11 not an ICC profile, invalid signature
Lcms2 error:  11 not an ICC profile, invalid signature
QFile::at: Cannot set file position 138379
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 140708
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 140767
QFile::at: Cannot set file position 199641
Lcms2 error:  11 not an ICC profile, invalid signature
Lcms2 error:  11 not an ICC profile, invalid signature
QFile::at: Cannot set file position 119347
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 129561
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 129620
QFile::at: Cannot set file position 199641
Lcms2 error:  11 not an ICC profile, invalid signature
Lcms2 error:  11 not an ICC profile, invalid signature
QFile::at: Cannot set file position 104384
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 110529
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 110588
QFile::at: Cannot set file position 199641
Lcms2 error:  11 not an ICC profile, invalid signature
Lcms2 error:  11 not an ICC profile, invalid signature
QFile::at: Cannot set file position 81037
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 95567
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 95625
QFile::at: Cannot set file position 199641
Lcms2 error:  11 not an ICC profile, invalid signature
Lcms2 error:  11 not an ICC profile, invalid signature
QFile::at: Cannot set file position 64646
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 72221
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 72279
QFile::at: Cannot set file position 199641
Lcms2 error:  11 not an ICC profile, invalid signature
Lcms2 error:  11 not an ICC profile, invalid signature
QFile::at: Cannot set file position 45472
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 55830
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 55888
QFile::at: Cannot set file position 199641
Lcms2 error:  11 not an ICC profile, invalid signature
Lcms2 error:  11 not an ICC profile, invalid signature
QFile::at: Cannot set file position 28663
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 36656
QFile::at: Cannot set file position 199641
QFile::at: Cannot set file position 36714
QFile::at: Cannot set file position 199641
Lcms2 error:  11 not an ICC profile, invalid signature
Lcms2 error:  11 not an ICC profile, invalid signature
The X11 connection broke: I/O error (code 1)
XIO:  fatal IO error 9 (Bad file descriptor) on X server ":0"
      after 2297 requests (2297 known processed) with 0 events remaining.
QFile::at: Cannot set file position 0
Unable to start Dr. Konqi

You can open Krita files with an unzipper, which I did, and I removed the generator layer(fill layer) from maindoc.xml, which did make it open in Krita. I am not sure if it is a corrupted file or that generator layer loading is broken, but you can work further with the fixed file.
Comment 3 Igor S. 2016-01-15 16:36:37 UTC
Thank you, glad to know, that the file can be just unzipped :-)
Comment 4 Halla Rempt 2016-01-20 10:22:12 UTC
Crash with the original file:

#0  0x00007ffff6ce071e in KisCloneLayer::original() const (this=<optimized out>) at /home/boud/kde/src/calligra/krita/image/kis_clone_layer.cpp:116
#1  0x00007ffff6d4d65f in KisLayer::projection() const (this=0x37a0730) at /home/boud/kde/src/calligra/krita/image/kis_layer.cc:717
#2  0x00007ffff6d5527c in KisLayerProjectionPlane::apply(KisPainter*, QRect const&) (this=0x31956b0, painter=0x7fffc77fdd20, rect=...)
    at /home/boud/kde/src/calligra/krita/image/kis_layer_projection_plane.cpp:52
#3  0x00007ffff6d19873 in KisAsyncMerger::startMerge(KisBaseRectsWalker&, bool) (rect=..., leaf=..., this=0x36c35b0) at /home/boud/kde/src/calligra/krita/image/kis_async_merger.cpp:344
#4  0x00007ffff6d19873 in KisAsyncMerger::startMerge(KisBaseRectsWalker&, bool) (this=this@entry=0x36c35b0, walker=..., notifyClones=notifyClones@entry=true)
    at /home/boud/kde/src/calligra/krita/image/kis_async_merger.cpp:272
#5  0x00007ffff6c69413 in KisUpdateJobItem::run() (this=0x36c3570) at /home/boud/kde/build/calligra/krita/image/../../../../src/calligra/krita/image/kis_update_job_item.h:77
#6  0x00007ffff6c69413 in KisUpdateJobItem::run() (this=0x36c3570) at /home/boud/kde/build/calligra/krita/image/../../../../src/calligra/krita/image/kis_update_job_item.h:58
#7  0x00007ffff1637ace in QThreadPoolThread::run() (this=0x36e9990) at concurrent/qthreadpool.cpp:108
#8  0x00007ffff1643bbf in QThreadPrivate::start(void*) (arg=0x36e9990) at thread/qthread_unix.cpp:349
#9  0x00007ffff13ad0a4 in start_thread () at /lib64/libpthread.so.0
#10 0x00007ffff037404d in clone () at /lib64/libc.so.6
Comment 5 Halla Rempt 2016-01-20 10:24:29 UTC
It's not simply that fill layers or clone layers with fill layers are broken, there's something more going on.
Comment 6 Halla Rempt 2016-01-20 10:33:57 UTC
Looks we also should consider saving the pattern in the generator layer, because just having the filename there is going to cause big trouble.
Comment 7 Halla Rempt 2016-01-20 10:59:08 UTC
Hm, it actually hasn't got anything to do with fill layers at all -- the clones don't seem to be from the fill, but a single paint layer.
Comment 8 Halla Rempt 2016-01-20 11:05:30 UTC
Git commit d664bb98d7882e5f63616ba08c8876ab5eacc886 by Boudewijn Rempt.
Committed on 20/01/2016 at 11:03.
Pushed by rempt into branch 'calligra/2.9'.

If the clone layers clone a layer above the clones in the stack,
the original isn't available during loading. Krita shouldn't recalculate
the project at this point, but merging already starts before the
original is available, so add a temporary dummy fallback paint
device that can be used until the original becomes available.

M  +4    -2    krita/image/kis_clone_layer.cpp

http://commits.kde.org/calligra/d664bb98d7882e5f63616ba08c8876ab5eacc886
Comment 9 Halla Rempt 2016-01-20 11:11:48 UTC
Git commit 8f7603ccd2a013695e5737c5a8b9058885c2f041 by Boudewijn Rempt.
Committed on 20/01/2016 at 11:10.
Pushed by rempt into branch 'master'.

If the clone layers clone a layer above the clones in the stack,
the original isn't available during loading. Krita shouldn't recalculate
the project at this point, but merging already starts before the
original is available, so add a temporary dummy fallback paint
device that can be used until the original becomes available.

M  +4    -2    krita/image/kis_clone_layer.cpp

http://commits.kde.org/krita/8f7603ccd2a013695e5737c5a8b9058885c2f041