Created attachment 108915 [details] backtrace for error Hi, I'm getting consistent crashes when applying g'mic filters to layers as 'blend [standard]'. It happens with most of the filter modes I've tried (grain extract, value, darken etc) Input/output options tried are 'active and below' or 'all'. other options are set at default. I'm using Windows 10 pro x64 Krita 3.3.2 (also crashed on 3.3.1)
What pixel format is your image in? What layers do you have in your file? (A sceenshot or even the file itself would help)
Created attachment 108917 [details] krita before opening q'mic and applying filter
Hi, I've tried various images in different pixel formats RGB 8/16/32 bit, CMYK 8/16/32. My workflow for the layers is to create a new image/open an existing image, then duplicate the layer once or twice, then start q'mic to apply the filter.
This is the windows error event generated by the crash, not sure if it's useful - Faulting application name: krita.exe, version: 0.0.0.0, time stamp: 0x01940641 Faulting module name: kritaqmic.dll, version: 0.0.0.0, time stamp: 0x00000000 Exception code: 0xc0000005 Fault offset: 0x0000000000013bd8 Faulting process id: 0x2aa0 Faulting application start time: 0x01d35fb548e9e345 Faulting application path: C:\Program Files\Krita (x64)\bin\krita.exe Faulting module path: C:\Program Files\Krita (x64)\lib\kritaplugins\kritaqmic.dll Report Id: 1710503b-e530-497f-8154-bce5725e98f8 Faulting package full name: Faulting package-relative application ID:
OK, Looks like I can reproduce the crash, seem to happen when Input Mode uses more than one layer. Perhaps due to output having less layers than input. Also crashes on 4.0 pre-alpha 2 (pretty much expected): krita.exe caused an Access Violation at location 00007FFC2E9E3DE8 in module kritaqmic.dll Reading from location FFFFFFFFFFFFFFFF. AddrPC Params 00007FFC2E9E3DE8 000000003E9A05B0 0000000026BEA090 0000000026BEA0BC kritaqmic.dll!visitNodeWithPaintDevice [C:/dev/4/64/i/include/QtCore/qdebug.h @ 146] 00007FFC33A6A8D3 000000003EB1ED40 0000000026BEA090 0000000026BEA0BC libkritaimage.dll! ?? [C:/dev/4/64/krita/libs/image/commands_new/kis_processing_command.cpp @ 35] 00007FFC33AE1EFF 0000000026BEA090 0000000000000000 0000000300000000 libkritaimage.dll!doStrokeCallback [C:/dev/4/64/krita/libs/image/kis_stroke_strategy_undo_command_based.cpp @ 73] 00007FFC33C9C442 000000002679F8D0 00007FFC350B93E0 000000002679F8D0 libkritaimage.dll!run [C:/dev/4/64/krita/libs/image/kis_base_node.h @ 320] 00007FFC34D7CF61 000000003EB1ED30 0000000026817E00 0000000000000000 Qt5Core.dll!QThreadPoolPrivate::clear 00007FFC34D80AA6 0000000000000000 0000000000000000 0000000000000000 Qt5Core.dll!QThreadStorageData::finish 00007FFC74691FE4 0000000000000000 0000000000000000 0000000000000000 KERNEL32.DLL!BaseThreadInitThunk 00007FFC76F5EF91 0000000000000000 0000000000000000 0000000000000000 ntdll.dll!RtlUserThreadStart Crash location is probably https://github.com/KDE/krita/blob/d6bfc136a743b2c30e72d8f76edccb3e2b027bc2/plugins/extensions/qmic/kis_import_qmic_processing_visitor.cpp#L73 The obvious mistake is not doing sanity bound checking on `m_images`, but more probably needs to be done to handle the action properly (perhaps involving layer deletion). I don't know enough to comment.
Hi Nicholas, since I saw that you've fixed a few things regarding gmic-qt in the past, perhaps you will know better than me?
(In reply to Alvin Wong from comment #6) > Hi Nicholas, since I saw that you've fixed a few things regarding gmic-qt in > the past, perhaps you will know better than me? I looked at this a bit and am not sure how to fix it myself, but I'll tell you what I found. There are separate enumerations for InputLayerMode and OutputMode inside of gmic.h that respectively match the "Input layers..." and "Output mode..." controls inside of G'MIC-Qt. Krita receives the correct OutputMode value when getting a "gmic_qt_output_images" message. It stores the value to m_outputMode (QMic.cpp line 245). (m_outputMode is never used for anything (it's only set, then set again if its value wasn't IN_PLACE), since Krita only supports IN_PLACE (I believe it was that way before G'MIC-Qt, as well.)) Similarly, the "gmic_qt_get_cropped_images" message leads to properly setting m_inputMode with an InputLayerMode. This value is used to generate a QList of the nodes which will be sent to G'MIC for processing (QMic.cpp line 398), and also for knowing what nodes will receive an image from G'MIC (QMic.cpp line 382). When running the "Blend [standard]" filter with two layers in the document and the ALL_LAYERS input mode, G'MIC gets two images and produces one. When we get the image back from G'MIC, we'll get to the above-mentioned line 382, which will end up causing Krita to try to apply images to two layers. Since there was only one image from G'MIC, Krita crashes. The same filter can also return, for example, two images given four input images, so placing the results into the correct layers may have to be taken into account when coming up with a fix. (Krita (1fbbed33e6cbc22debfca29fe995772977d4fefe, before G'MIC-Qt) had different behavior when compared to GIMP with G'MIC-Qt in regards to the deletion of layers after running the filter, so I suspect that it may have put the results into the wrong layers. I haven't done much to check this in any way, however.) Let me know if there is anything that needs more explanation or testing.
*** Bug 385232 has been marked as a duplicate of this bug. ***
Git commit f0e7c96030454274daa117b0489fc04fee8152c7 by Jouni Pentikäinen. Committed on 12/10/2018 at 15:32. Pushed by jounip into branch 'master'. Fix crash when GMic returns fewer layers than expected M +1 -1 plugins/extensions/qmic/kis_import_qmic_processing_visitor.cpp https://commits.kde.org/krita/f0e7c96030454274daa117b0489fc04fee8152c7
Git commit 5ede49ea44095197ae187d79aed77df61c909ab3 by Boudewijn Rempt, on behalf of Jouni Pentikäinen. Committed on 20/11/2018 at 08:21. Pushed by rempt into branch 'krita/4.1'. Fix crash when GMic returns fewer layers than expected M +1 -1 plugins/extensions/qmic/kis_import_qmic_processing_visitor.cpp https://commits.kde.org/krita/5ede49ea44095197ae187d79aed77df61c909ab3