Bug 424187 - [Color-adjustement curve filter] Crash on CMYK document when switching to "saturation" channel
Summary: [Color-adjustement curve filter] Crash on CMYK document when switching to "sa...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Filters (show other bugs)
Version: 4.3.0
Platform: Appimage Linux
: NOR crash
Target Milestone: ---
Assignee: Tiar
URL:
Keywords:
: 421255 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-07-14 10:34 UTC by David REVOY
Modified: 2020-07-21 08:42 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David REVOY 2020-07-14 10:34:15 UTC
Hi,
I tried to adjust the saturation curve of a CMYK document and obtained a reproducible crash. I already found a workaround (explained under) and it was while experimenting with softproofing book covers for my epic-long-book-project-quest; no data lost, so no frustration or workflow blocker here.

To reproduce:
=============
1. Open a CMYK document (or create a new CMYK)
2. Press Ctrl+M to opent the filter "Color adjustement curves" (or via menu: Filter>Adjust)
3. Change the channel from "CMYKA" at opening to "Saturation"

Result:
=======
Krita crashes. 

The crash is also reproducible with:
- Filter layers
- Selecting channel: "Luminosity". 

Workaround:
===========
Cross channel adjustement curve has no issue manipulating saturation/luminosity of CMYK document
Comment 1 Halla Rempt 2020-07-14 10:51:26 UTC
I can confirm the issue:

ASSERT failure in QList<T>::operator[]: "index out of range", file /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h, line 579

[KCrash Handler]
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007fcc538a28b1 in __GI_abort () at abort.c:79
#6  0x00007fcc542cd68b in qt_message_fatal (context=..., message=<synthetic pointer>...) at global/qlogging.cpp:1914
#7  QMessageLogger::fatal (this=this@entry=0x7ffcf3066720, msg=msg@entry=0x7fcc545cd9c8 "ASSERT failure in %s: \"%s\", file %s, line %d") at global/qlogging.cpp:893
#8  0x00007fcc542ccedb in qt_assert_x (where=where@entry=0x7fcc224f9b1d "QList<T>::operator[]", what=what@entry=0x7fcc224f7d58 "index out of range", file=file@entry=0x7fcc224f97f0 "/usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h", line=line@entry=579) at global/qglobal.cpp:3350
#9  0x00007fcc224c9d85 in QList<KoChannelInfo*>::operator[] (i=<optimized out>, this=<optimized out>) at /home/boud/dev/4.3/plugins/filters/colorsfilters/kis_multichannel_filter_base.h:38
#10 KisPerChannelConfigWidget::updateChannelControls (this=0x55ce193c8210) at /home/boud/dev/4.3/plugins/filters/colorsfilters/kis_perchannel_filter.cpp:104
#11 0x00007fcc224dcb92 in KisMultiChannelConfigWidget::setActiveChannel (this=0x55ce193c8210, ch=<optimized out>) at /home/boud/dev/4.3/plugins/filters/colorsfilters/kis_multichannel_filter_base.cpp:505
#12 0x00007fcc224dd6ac in KisMultiChannelConfigWidget::slotChannelSelected (this=0x55ce193c8210, index=<optimized out>) at /home/boud/dev/4.3/plugins/filters/colorsfilters/kis_multichannel_filter_base.cpp:491
#13 0x00007fcc5451c4b9 in doActivate<false> (sender=0x55ce0f1aa560, signal_index=8, argv=0x7ffcf30669a0) at kernel/qobject.cpp:3882
#14 0x00007fcc554cfed1 in QComboBox::activated(int) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00007fcc554d1b6e in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007fcc554d3354 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007fcc554d908d in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#18 0x00007fcc5451c4b9 in doActivate<false> (sender=0x55ce194b8c20, signal_index=7, argv=0x7ffcf3066b70) at kernel/qobject.cpp:3882
#19 0x00007fcc554d0042 in QComboBoxPrivateContainer::itemSelected(QModelIndex const&) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#20 0x00007fcc554d04b7 in QComboBoxPrivateContainer::eventFilter(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#21 0x00007fcc544e122d in QCoreApplicationPrivate::sendThroughObjectEventFilters (receiver=0x55ce194493a0, event=0x7ffcf3067160) at kernel/qcoreapplication.cpp:1201
#22 0x00007fcc553d0982 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#23 0x00007fcc553d89f8 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#24 0x00007fcc57dc4aa9 in KisApplication::notify (this=<optimized out>, receiver=0x55ce194493a0, event=0x7ffcf3067160) at /home/boud/dev/4.3/libs/ui/KisApplication.cpp:680
#25 0x00007fcc544e14a8 in QCoreApplication::notifyInternal2 (receiver=0x55ce194493a0, event=0x7ffcf3067160) at kernel/qcoreapplication.cpp:1075
#26 0x00007fcc553d707f in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#27 0x00007fcc5542c664 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#28 0x00007fcc5542edea in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#29 0x00007fcc553d09ac in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#30 0x00007fcc553d7bb0 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#31 0x00007fcc57dc4aa9 in KisApplication::notify (this=<optimized out>, receiver=0x7fcc34008da0, event=0x7ffcf3067660) at /home/boud/dev/4.3/libs/ui/KisApplication.cpp:680
#32 0x00007fcc544e14a8 in QCoreApplication::notifyInternal2 (receiver=0x7fcc34008da0, event=0x7ffcf3067660) at kernel/qcoreapplication.cpp:1075
#33 0x00007fcc54ade8b5 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#34 0x00007fcc54adf9e5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#35 0x00007fcc54ab81cb in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#36 0x00007fcc44a5df9a in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#37 0x00007fcc4b83d417 in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#38 0x00007fcc4b83d650 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#39 0x00007fcc4b83d6dc in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#40 0x00007fcc545407ac in QEventDispatcherGlib::processEvents (this=0x55ce0d318bc0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#41 0x00007fcc544dfd2a in QEventLoop::exec (this=this@entry=0x7ffcf3067a00, flags=..., flags@entry=...) at kernel/qeventloop.cpp:225
#42 0x00007fcc544e94a0 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1383
#43 0x000055ce0a5a8b47 in main (argc=<optimized out>, argv=0x7ffcf3067d28) at /home/boud/dev/4.3/krita/main.cc:594
[Inferior 1 (process 4744) detached]
Comment 2 Tiar 2020-07-14 22:20:54 UTC
Git commit cc273e4985c42f940c60908be6d02ed47554652e by Agata Cacko.
Committed on 14/07/2020 at 19:36.
Pushed by tymond into branch 'master'.

Fix crash on curve adjustment filter in CMYK document

Before this commit, Krita will crash on accessing Saturation
or other "fake" channel in the curve adjustment filter dialog.
This commit fixes it.
The problem was in recent change in the PerChannelFilter,
it would access the actual channels of the color space
to set min and max of the dialog. Since Saturation isn't
a channel of the CMYK color space, it would crash.

I'm not 100% sure the code here doesn't have any more
issues but I don't know how it exactly should be written.
In any case, this commit improves the situation by setting min
and max manually in case of "fake" channels. This is consistent
with the old behaviour before dffa076018d6bf98ec0.

M  +10   -2    plugins/filters/colorsfilters/kis_perchannel_filter.cpp

https://invent.kde.org/graphics/krita/commit/cc273e4985c42f940c60908be6d02ed47554652e
Comment 3 Tiar 2020-07-15 12:56:25 UTC
*** Bug 421255 has been marked as a duplicate of this bug. ***
Comment 4 Halla Rempt 2020-07-21 08:42:02 UTC
Git commit 4943251ee97cc9f4320daa5fd73cce2d8c74b695 by Boudewijn Rempt, on behalf of Agata Cacko.
Committed on 21/07/2020 at 08:25.
Pushed by rempt into branch 'krita/4.3'.

Fix crash on curve adjustment filter in CMYK document

Before this commit, Krita will crash on accessing Saturation
or other "fake" channel in the curve adjustment filter dialog.
This commit fixes it.
The problem was in recent change in the PerChannelFilter,
it would access the actual channels of the color space
to set min and max of the dialog. Since Saturation isn't
a channel of the CMYK color space, it would crash.

I'm not 100% sure the code here doesn't have any more
issues but I don't know how it exactly should be written.
In any case, this commit improves the situation by setting min
and max manually in case of "fake" channels. This is consistent
with the old behaviour before dffa076018d6bf98ec0.
(cherry picked from commit cc273e4985c42f940c60908be6d02ed47554652e)

M  +10   -2    plugins/filters/colorsfilters/kis_perchannel_filter.cpp

https://invent.kde.org/graphics/krita/commit/4943251ee97cc9f4320daa5fd73cce2d8c74b695