Bug 384941 - Crashes almost every time I copy a layer and click on a different file to try and paste it to
Summary: Crashes almost every time I copy a layer and click on a different file to try...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 3.2.1
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-21 19:19 UTC by Dhanesh
Modified: 2017-11-21 11:03 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Demonstration of the problem (998.35 KB, video/mp4)
2017-09-21 19:19 UTC, Dhanesh
Details
Crash log attached (243.31 KB, text/plain)
2017-09-22 09:28 UTC, Dhanesh
Details
Tested out 3.3.0 (1.28 MB, video/mp4)
2017-09-22 15:26 UTC, Dhanesh
Details
Crash log for krita-3.3.0-rc.1-x64 (14.19 KB, text/plain)
2017-09-22 17:14 UTC, Dhanesh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dhanesh 2017-09-21 19:19:34 UTC
Created attachment 107940 [details]
Demonstration of the problem

Crashes almost every time I copy a layer and click on a different file to try and paste it to. I have attached a video demonstrating the problem. I have faced this in a previous version as well
Comment 1 Alvin Wong 2017-09-22 07:13:16 UTC
Please provide the backtrace: https://docs.krita.org/Dr._Mingw_debugger
Comment 2 Dhanesh 2017-09-22 09:28:39 UTC
Created attachment 107948 [details]
Crash log attached

I suppose this is what you are looking for..
Comment 3 Alvin Wong 2017-09-22 13:16:56 UTC
Hm, I cannot reproduce a crash. Can you please try the 3.3.0-rc.1? https://krita.org/en/item/krita-3-3-0-first-release-candidate/

Download the portable version and extract it. Also download the debug symbols and extract it like the instructions in https://docs.krita.org/Dr._Mingw_debugger
This will give more details for our reference if it still crashes.

(Also, you can clear the existing kritacrash.log file before testing so that you won't be uploading your previous crashes again the next time.)
Comment 4 Dhanesh 2017-09-22 15:24:40 UTC
I tested version 3.3.0-rc.1. I got an error when I try to close the file after pasting a layer. 

I have downloaded the debug symbols and copied it to bin as required, but I am not sure how to use it.

This is what I got out of Visual Studio on hitting debug:
Unhandled exception at 0x00007FFFFD3BCA7A (libkritaimage.dll) in krita.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF. occurred
Comment 5 Dhanesh 2017-09-22 15:26:00 UTC
Created attachment 107953 [details]
Tested out 3.3.0

I tested version 3.3.0-rc.1. I got an error when I try to close the file after pasting a layer. 

I have downloaded the debug symbols and copied it to bin as required, but I don't know how to use it.

This is what I got out of Visual Studio on hitting debug:
Unhandled exception at 0x00007FFFFD3BCA7A (libkritaimage.dll) in krita.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF. occurred
Comment 6 Alvin Wong 2017-09-22 15:30:46 UTC
> I have downloaded the debug symbols and copied it to bin as required, but I
> don't know how to use it.
> 
> This is what I got out of Visual Studio on hitting debug:
> Unhandled exception at 0x00007FFFFD3BCA7A (libkritaimage.dll) in krita.exe:
> 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF. occurred

Nah you just let the built-in crash handler dump the stack trace to kritacrash.log and get it from there, like how you got the previous one.

(Or if you want to use a debugger you can download a copy of mingw-w64 and run Krita under gdb, but this isn't really needed...)
Comment 7 Dhanesh 2017-09-22 15:48:00 UTC
Oh... In that case, where will I find the kritacrash.log file? It is not appearing in %localappdata% or krita-3.3.0-rc.1-x64 folder..
Comment 8 Alvin Wong 2017-09-22 15:55:05 UTC
(In reply to Dhanesh from comment #7)
> Oh... In that case, where will I find the kritacrash.log file? It is not
> appearing in %localappdata% or krita-3.3.0-rc.1-x64 folder..

Oh... I just realized that the release is missing several files... so the crash log wouldn't be there...

You have 3.2.1 installed right? You can go to C:\Program Files\Krita (x64)\bin, and copy these files to the rita-3.3.0-rc.1-x64/bin/ folder:

dbghelp.dll
exchndl.dll
mgwhelp.dll
symsrv.dll
symsrv.yes

After that you can try again, it should save the backtrace when it crashes (it might take a while)
Comment 9 Dhanesh 2017-09-22 17:14:44 UTC
Created attachment 107955 [details]
Crash log for krita-3.3.0-rc.1-x64

Oh great! Found and attached the log..
Comment 10 Alvin Wong 2017-09-22 17:33:36 UTC
Thanks, though I still can't reproduce it... I am guessing it might be a race condition...
Comment 11 Dhanesh 2017-09-22 17:41:52 UTC
Do you mean rare? If so, is there something that I can possibly turn off to manage this?
Comment 12 Alvin Wong 2017-09-22 17:57:13 UTC
(In reply to Dhanesh from comment #11)
> Do you mean rare? If so, is there something that I can possibly turn off to
> manage this?

Well, I can't tell unless I am able to reproduce it...

From the videos it looks like you are trying to combine files as layers? You can try using Layer->Import/Export functions instead, they should not trigger this crash.
Comment 13 Dhanesh 2017-09-22 18:08:13 UTC
Ahh.. This works for me! Thanks for your advice & your time! It is interesting though how the crash does not happen to you. Anyway, good day to you!
Comment 14 Dmitry Kazakov 2017-09-26 15:09:31 UTC
I tested the bug. I cannot reproduce the crash on pasting, but I can clearly reproduce the crash on closing Krita.

It looks as if X11 is trying to fetch the data from the clipboard before
closing the app.

#0  0x00007ffff5c885c0 in QObject::thread() const () from /home/devel5/kde-install/krita2-deps/lib/libQt5Core.so.5
#1  0x00007ffff76443d8 in KisConfig::~KisConfig (this=0x7fffffffcde0, __in_chrg=<optimized out>) at /home/devel5/kde-src/krita4/libs/ui/kis_config.cc:60
#2  0x00007ffff759cced in KisGuidesConfig::loadStaticData (this=this@entry=0xaefc648) at /home/devel5/kde-src/krita4/libs/ui/canvas/kis_guides_config.cpp:203
#3  0x00007ffff759cf35 in KisGuidesConfig::KisGuidesConfig (this=0xaefc648) at /home/devel5/kde-src/krita4/libs/ui/canvas/kis_guides_config.cpp:67
#4  0x00007ffff78afa86 in KisDocument::Private::Private (document=0x7cd4d40, this=0xaefc5a0) at /home/devel5/kde-src/krita4/libs/ui/KisDocument.cpp:285
#5  KisDocument::KisDocument (this=0x7cd4d40) at /home/devel5/kde-src/krita4/libs/ui/KisDocument.cpp:535
#6  0x00007ffff78ed92b in KisPart::createDocument (this=<optimized out>) at /home/devel5/kde-src/krita4/libs/ui/KisPart.cpp:183
#7  0x00007ffff7685d58 in createDocument (nodes=..., srcImage=...) at /home/devel5/kde-src/krita4/libs/ui/kis_mimedata.cpp:98
#8  0x00007ffff76863f5 in serializeToByteArray (nodes=..., srcImage=...) at /home/devel5/kde-src/krita4/libs/ui/kis_mimedata.cpp:120
#9  0x00007ffff7686ae8 in KisMimeData::retrieveData (this=<optimized out>, mimetype=..., preferredType=<optimized out>) at /home/devel5/kde-src/krita4/libs/ui/kis_mimedata.cpp:140
#10 0x00007ffff5c848e4 in ?? () from /home/devel5/kde-install/krita2-deps/lib/libQt5Core.so.5
#11 0x00007ffff5c85a3d in QMimeData::data(QString const&) const () from /home/devel5/kde-install/krita2-deps/lib/libQt5Core.so.5
#12 0x00007ffff601c7d6 in QInternalMimeData::renderDataHelper(QString const&, QMimeData const*) () from /home/devel5/kde-install/krita2-deps/lib/libQt5Gui.so.5
#13 0x00007fffea0f5a65 in ?? () from /home/devel5/kde-install/krita2-deps/plugins/platforms/../../lib/libQt5XcbQpa.so.5
#14 0x00007fffea0e6125 in ?? () from /home/devel5/kde-install/krita2-deps/plugins/platforms/../../lib/libQt5XcbQpa.so.5
#15 0x00007fffea0e67f2 in ?? () from /home/devel5/kde-install/krita2-deps/plugins/platforms/../../lib/libQt5XcbQpa.so.5
#16 0x00007fffea0ef261 in QXcbConnection::handleXcbEvent(xcb_generic_event_t*) () from /home/devel5/kde-install/krita2-deps/plugins/platforms/../../lib/libQt5XcbQpa.so.5
#17 0x00007fffea0e5317 in ?? () from /home/devel5/kde-install/krita2-deps/plugins/platforms/../../lib/libQt5XcbQpa.so.5
#18 0x00007fffea0e54cc in ?? () from /home/devel5/kde-install/krita2-deps/plugins/platforms/../../lib/libQt5XcbQpa.so.5
#19 0x00007fffea0e5529 in ?? () from /home/devel5/kde-install/krita2-deps/plugins/platforms/../../lib/libQt5XcbQpa.so.5
#20 0x00007fffea0ef90b in QXcbConnection::~QXcbConnection() () from /home/devel5/kde-install/krita2-deps/plugins/platforms/../../lib/libQt5XcbQpa.so.5
#21 0x00007fffea0efe59 in QXcbConnection::~QXcbConnection() () from /home/devel5/kde-install/krita2-deps/plugins/platforms/../../lib/libQt5XcbQpa.so.5
#22 0x00007fffea0f1676 in QXcbIntegration::~QXcbIntegration() () from /home/devel5/kde-install/krita2-deps/plugins/platforms/../../lib/libQt5XcbQpa.so.5
#23 0x00007fffea0f1779 in QXcbIntegration::~QXcbIntegration() () from /home/devel5/kde-install/krita2-deps/plugins/platforms/../../lib/libQt5XcbQpa.so.5
#24 0x00007ffff6001003 in QGuiApplicationPrivate::~QGuiApplicationPrivate() () from /home/devel5/kde-install/krita2-deps/lib/libQt5Gui.so.5
#25 0x00007ffff667ccc9 in QApplicationPrivate::~QApplicationPrivate() () from /home/devel5/kde-install/krita2-deps/lib/libQt5Widgets.so.5
#26 0x00007ffff5c91ebc in QObject::~QObject() () from /home/devel5/kde-install/krita2-deps/lib/libQt5Core.so.5
#27 0x00007ffff5c5fb22 in QCoreApplication::~QCoreApplication() () from /home/devel5/kde-install/krita2-deps/lib/libQt5Core.so.5
#28 0x00007ffff667e7f4 in QApplication::~QApplication() () from /home/devel5/kde-install/krita2-deps/lib/libQt5Widgets.so.5
#29 0x00007ffff79172fe in QtSingleApplication::~QtSingleApplication (this=0x7fffffffdf70, __in_chrg=<optimized out>) at /home/devel5/kde-src/krita4/libs/ui/qtsingleapplication/qtsingleapplication.cpp:102
#30 0x0000000000405026 in main (argc=1, argv=<optimized out>) at /home/devel5/kde-src/krita4/krita/main.cc:151
(gdb)
Comment 15 Dmitry Kazakov 2017-09-26 15:54:27 UTC
Git commit 1fdfe0e9bb977cb33f65f116bf925c4d63ef279d by Dmitry Kazakov.
Committed on 26/09/2017 at 15:54.
Pushed by dkazakov into branch 'krita/3.2'.

Fix crash on closing Krita when there is something in the clipboard

It seems like Qt requests mime contents of the clipboard on exit.
But by the time it requests the stuff, Krita's KisApplication is
already dead, therefore we can use neither signals nor timers.

M  +10   -0    libs/ui/kis_mimedata.cpp

https://commits.kde.org/krita/1fdfe0e9bb977cb33f65f116bf925c4d63ef279d
Comment 16 Dmitry Kazakov 2017-09-26 15:55:26 UTC
Git commit 3a0a518f9bf990f853c649f1406c831c1b9110f8 by Dmitry Kazakov.
Committed on 26/09/2017 at 15:55.
Pushed by dkazakov into branch 'master'.

Fix crash on closing Krita when there is something in the clipboard

It seems like Qt requests mime contents of the clipboard on exit.
But by the time it requests the stuff, Krita's KisApplication is
already dead, therefore we can use neither signals nor timers.

M  +10   -0    libs/ui/kis_mimedata.cpp

https://commits.kde.org/krita/3a0a518f9bf990f853c649f1406c831c1b9110f8
Comment 17 Dmitry Kazakov 2017-09-26 15:56:17 UTC
Git commit cce4dc13d27522c5a3b3c5146d1d9a7b40b3c799 by Dmitry Kazakov.
Committed on 26/09/2017 at 15:55.
Pushed by dkazakov into branch 'krita/3.3'.

Fix crash on closing Krita when there is something in the clipboard

It seems like Qt requests mime contents of the clipboard on exit.
But by the time it requests the stuff, Krita's KisApplication is
already dead, therefore we can use neither signals nor timers.

M  +10   -0    libs/ui/kis_mimedata.cpp

https://commits.kde.org/krita/cce4dc13d27522c5a3b3c5146d1d9a7b40b3c799
Comment 18 Dhanesh 2017-09-26 16:02:57 UTC
Glad you could find it! Thanks!