Bug 397796 - Safe assert when copy/pasting a transform mask
Summary: Safe assert when copy/pasting a transform mask
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layer Stack (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: Halla Rempt
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2018-08-23 15:14 UTC by Halla Rempt
Modified: 2019-05-21 07:23 UTC (History)
2 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 Halla Rempt 2018-08-23 15:14:36 UTC
Application: krita (4.2.0-pre-alpha (git 5e2a52d))

Qt Version: 5.10.1
Frameworks Version: 5.47.0
Operating System: Linux 4.15.0-30-generic x86_64
Distribution: Ubuntu 18.04.1 LTS

-- Information about the crash:
When trying to copy paste a transform mask, this assert fires. It should be possible to copy and paste a transform mask on another layer.

The crash can be reproduced every time.

-- Backtrace:
Application: Krita (krita), signal: Aborted
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f56a5dbf600 (LWP 27427))]

Thread 4 (Thread 0x7f5668ec2700 (LWP 27432)):
#0  0x00007f56a1f84bf9 in __GI___poll (fds=0x7f5658003ce0, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f569a365439 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f569a36554c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f56a2af81bb in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007f56a2a9bb6a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007f56a28b17ea in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007f568c5d4885 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#7  0x00007f56a28b6b4f in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007f569bc616db in start_thread (arg=0x7f5668ec2700) at pthread_create.c:463
#9  0x00007f56a1f9188f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 3 (Thread 0x7f56686c1700 (LWP 27431)):
#0  0x00007f569bc679f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x55adbee18bc4) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x55adbee18b70, cond=0x55adbee18b98) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=0x55adbee18b98, mutex=0x55adbee18b70) at pthread_cond_wait.c:655
#3  0x00007f56a28b7fbb in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007f56a28b03af in QSemaphore::tryAcquire(int, int) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007f569fd64e73 in KisTileDataSwapper::waitForWork (this=<optimized out>) at /home/boud/dev/krita/libs/image/tiles3/swap/kis_tile_data_swapper.cpp:86
#6  0x00007f569fd650ca in KisTileDataSwapper::run (this=0x7f56a042afc0 <_ZZN12_GLOBAL__N_116Q_QGS_s_instance13innerFunctionEvE6holder+64>) at /home/boud/dev/krita/libs/image/tiles3/swap/kis_tile_data_swapper.cpp:92
#7  0x00007f56a28b6b4f in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007f569bc616db in start_thread (arg=0x7f56686c1700) at pthread_create.c:463
#9  0x00007f56a1f9188f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7f568119e700 (LWP 27429)):
#0  0x00007f56a1f800b4 in __GI___libc_read (fd=8, buf=0x7f568119db60, nbytes=16) at ../sysdeps/unix/sysv/linux/read.c:27
#1  0x00007f569a3a9960 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f569a364f27 in g_main_context_check () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f569a3653e0 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007f569a36554c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007f56a2af81bb in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007f56a2a9bb6a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007f56a28b17ea in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007f569be8edf5 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
#9  0x00007f56a28b6b4f in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#10 0x00007f569bc616db in start_thread (arg=0x7f568119e700) at pthread_create.c:463
#11 0x00007f56a1f9188f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7f56a5dbf600 (LWP 27427)):
[KCrash Handler]
#6  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#7  0x00007f56a1eb0801 in __GI_abort () at abort.c:79
#8  0x00007f56a28a1197 in QMessageLogger::fatal(char const*, ...) const () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#9  0x00007f56a414d16d in kis_assert_common (assertion=assertion@entry=0x7f56a0149f04 "allowAsChild(newNode)", file=file@entry=0x7f56a0149de0 "/home/boud/dev/krita/libs/image/kis_node.cpp", line=line@entry=480, throwException=throwException@entry=false, isIgnorable=isIgnorable@entry=true) at /home/boud/dev/krita/libs/global/kis_assert.cpp:90
#10 0x00007f56a414d5ad in kis_safe_assert_recoverable (assertion=assertion@entry=0x7f56a0149f04 "allowAsChild(newNode)", file=file@entry=0x7f56a0149de0 "/home/boud/dev/krita/libs/image/kis_node.cpp", line=line@entry=480) at /home/boud/dev/krita/libs/global/kis_assert.cpp:108
#11 0x00007f569ff9eb58 in KisNode::add (this=this@entry=0x55adc123a120, newNode=..., aboveThis=...) at /home/boud/dev/krita/libs/image/kis_node.cpp:480
#12 0x00007f569ffa1ffa in KisNodeFacade::addNode (this=0x55adc1487400, node=..., parent=...) at /home/boud/dev/krita/libs/image/kis_node_facade.cpp:113
#13 0x00007f56a4f49c48 in createDocument (nodes=..., srcImage=...) at /home/boud/dev/krita/libs/ui/kis_mimedata.cpp:109
#14 0x00007f56a4f4cea5 in KisMimeData::retrieveData (this=<optimized out>, mimetype=..., preferredType=<optimized out>) at /home/boud/dev/krita/libs/ui/kis_mimedata.cpp:147
#15 0x00007f56a2ac5df0 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#16 0x00007f56a2ac6f58 in QMimeData::imageData() const () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#17 0x00007f56a301700c in QClipboard::image(QClipboard::Mode) const () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#18 0x00007f56a4edbd1c in KisClipboard::clipboardDataChanged (this=0x7f56a5bdba10 <_ZZN12_GLOBAL__N_116Q_QGS_s_instance13innerFunctionEvE6holder>) at /home/boud/dev/krita/libs/ui/kis_clipboard.cc:353
#19 0x00007f56a2acd195 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007f56a3017419 in QClipboard::emitChanged(QClipboard::Mode) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#21 0x00007f5692623be5 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#22 0x00007f56a301717e in QClipboard::setMimeData(QMimeData*, QClipboard::Mode) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#23 0x00007f56a4edb866 in KisClipboard::setLayers (this=<optimized out>, nodes=..., image=..., forceCopy=<optimized out>) at /home/boud/dev/krita/libs/ui/kis_clipboard.cc:447
#24 0x00007f56a4f5ece0 in KisNodeManager::copyLayersToClipboard (this=<optimized out>) at /home/boud/dev/krita/libs/ui/kis_node_manager.cpp:1325
#25 0x00007f56a5321246 in KisNodeManager::qt_static_metacall (_o=0x55adbe78faf8, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /home/boud/dev/b-krita/libs/ui/kritaui_autogen/EWIEGA46WW/moc_kis_node_manager.cpp:361
#26 0x00007f56a2acd195 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#27 0x00007f56a37f3e52 in QAction::triggered(bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#28 0x00007f56a37f659c in QAction::activate(QAction::ActionEvent) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#29 0x00007f56a397561c in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#30 0x00007f56a397caeb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#31 0x00007f56a397d913 in QMenu::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#32 0x00007f56a3839378 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#33 0x00007f56a397fbeb in QMenu::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#34 0x00007f56a37fa6cc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#35 0x00007f56a38023df in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#36 0x00007f56a51fa397 in KisApplication::notify (this=<optimized out>, receiver=0x7ffc411c29b0, event=0x7ffc411c2220) at /home/boud/dev/krita/libs/ui/KisApplication.cpp:608
#37 0x00007f56a2a9d938 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#38 0x00007f56a38013b2 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#39 0x00007f56a385420a in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#40 0x00007f56a3856b09 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#41 0x00007f56a37fa6cc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#42 0x00007f56a3801e84 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#43 0x00007f56a51fa397 in KisApplication::notify (this=<optimized out>, receiver=0x55adc7c6c100, event=0x7ffc411c2690) at /home/boud/dev/krita/libs/ui/KisApplication.cpp:608
#44 0x00007f56a2a9d938 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#45 0x00007f56a3009603 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#46 0x00007f56a300b0d5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#47 0x00007f56a2fe303b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#48 0x00007f56926af2cb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#49 0x00007f56a2a9bb6a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#50 0x00007f56a397a840 in QMenu::exec(QPoint const&, QAction*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#51 0x00007f566bb97ef1 in KisLayerBox::slotContextMenuRequested (this=<optimized out>, pos=..., index=...) at /home/boud/dev/krita/plugins/dockers/defaultdockers/kis_layer_box.cpp:646
#52 0x00007f566bb9857d in KisLayerBox::qt_static_metacall (_o=0x55adbfd2e2f0, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /home/boud/dev/b-krita/plugins/dockers/defaultdockers/kritadefaultdockers_autogen/include/moc_kis_layer_box.cpp:224
#53 0x00007f56a2acd195 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#54 0x00007f56a5311e67 in KisNodeView::contextMenuRequested (this=this@entry=0x55adc059df30, _t1=..., _t2=...) at /home/boud/dev/b-krita/libs/ui/kritaui_autogen/EWIEGA46WW/moc_KisNodeView.cpp:211
#55 0x00007f56a521b0c5 in KisNodeView::showContextMenu (index=..., globalPos=..., this=<optimized out>) at /home/boud/dev/krita/libs/ui/KisNodeView.cpp:304
#56 KisNodeView::contextMenuEvent (this=0x55adc059df30, e=0x7ffc411c33c0) at /home/boud/dev/krita/libs/ui/KisNodeView.cpp:299
#57 0x00007f56a383a15a in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#58 0x00007f56a38da3de in QFrame::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#59 0x00007f56a3a5051b in QAbstractItemView::viewportEvent(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#60 0x00007f56a3ab8e9c in QTreeView::viewportEvent(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#61 0x00007f56a521a4ab in KisNodeView::viewportEvent (this=0x55adc059df30, e=0x7ffc411c33c0) at /home/boud/dev/krita/libs/ui/KisNodeView.cpp:290
#62 0x00007f56a2a9d61c in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#63 0x00007f56a37fa6a5 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#64 0x00007f56a3802bee in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#65 0x00007f56a51fa397 in KisApplication::notify (this=<optimized out>, receiver=0x55adc059e5b0, event=0x7ffc411c33c0) at /home/boud/dev/krita/libs/ui/KisApplication.cpp:608
#66 0x00007f56a2a9d938 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#67 0x00007f56a3854608 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#68 0x00007f56a3856b09 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#69 0x00007f56a37fa6cc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#70 0x00007f56a3801e84 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#71 0x00007f56a51fa397 in KisApplication::notify (this=<optimized out>, receiver=0x55adbe925500, event=0x7ffc411c3830) at /home/boud/dev/krita/libs/ui/KisApplication.cpp:608
#72 0x00007f56a2a9d938 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#73 0x00007f56a3009603 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#74 0x00007f56a300b0d5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#75 0x00007f56a2fe303b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#76 0x00007f56926af2cb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#77 0x00007f56a2a9bb6a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#78 0x00007f56a2aa4ed4 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#79 0x000055adb3a2017a in main (argc=<optimized out>, argv=0x7ffc411c3d88) at /home/boud/dev/krita/krita/main.cc:435

Possible duplicates by query: bug 395743, bug 392092, bug 389875, bug 389801, bug 389503.

Reported using DrKonqi
Comment 1 mvowada 2018-08-24 07:38:41 UTC
Confirming :) (Version: 4.2.0-pre-alpha (git 04931e4) - Ubuntu 14.04)
Comment 2 Halla Rempt 2019-05-09 11:12:03 UTC
Git commit efb062b8de124cbe32c9f0f219d16a4009b15268 by Boudewijn Rempt.
Committed on 09/05/2019 at 11:10.
Pushed by rempt into branch 'master'.

Allow masks on group layers

When copying a mask to the clipboard, the masks are added to a
default, empty image. That means, to a group layer without a
parent. This is perfectly fine, but we have never allowed it
before. The only important check is whether the root layer already
has a selection mask, the global selection.

M  +11   -4    libs/image/kis_group_layer.cc

https://invent.kde.org/kde/krita/commit/efb062b8de124cbe32c9f0f219d16a4009b15268
Comment 3 Dmitry Kazakov 2019-05-09 18:05:08 UTC
The fix is reverted by Boud
Comment 4 Dmitry Kazakov 2019-05-16 21:00:21 UTC
Git commit ad3649935d0a2a7c9b6e4f6fecc421c69e53c3ca by Dmitry Kazakov.
Committed on 16/05/2019 at 21:00.
Pushed by dkazakov into branch 'master'.

Recover forbidding rule for adding masks to the root layer

We shoould not allow adding a mask to normal root layers. It makes
painters confused. But for clipboard contents is it perfectly okay,
so just add an option for it.

M  +8    -0    libs/image/kis_group_layer.cc
M  +12   -0    libs/image/kis_image.cc
M  +12   -0    libs/image/kis_image.h
M  +1    -0    libs/ui/kis_mimedata.cpp

https://invent.kde.org/kde/krita/commit/ad3649935d0a2a7c9b6e4f6fecc421c69e53c3ca
Comment 5 Halla Rempt 2019-05-17 08:13:01 UTC
Git commit e2bdef9254b300f5698cf8696d77434154cfde30 by Boudewijn Rempt, on behalf of Dmitry Kazakov.
Committed on 17/05/2019 at 08:12.
Pushed by rempt into branch 'krita/4.2'.

Recover forbidding rule for adding masks to the root layer

We shoould not allow adding a mask to normal root layers. It makes
painters confused. But for clipboard contents is it perfectly okay,
so just add an option for it.

M  +8    -0    libs/image/kis_group_layer.cc
M  +12   -0    libs/image/kis_image.cc
M  +12   -0    libs/image/kis_image.h
M  +1    -0    libs/ui/kis_mimedata.cpp

https://invent.kde.org/kde/krita/commit/e2bdef9254b300f5698cf8696d77434154cfde30
Comment 6 Dmitry Kazakov 2019-05-20 12:33:53 UTC
Git commit ad31625eae8f9701e5de65b11d79065139ce3741 by Dmitry Kazakov.
Committed on 20/05/2019 at 12:33.
Pushed by dkazakov into branch 'master'.

One more try to fix restriction for adding masks to the root layer

We should not allow adding a mask to normal root layers. It makes
painters confused. But for clipboard contents is it perfectly okay,
so just add an option for it.

It the previous version the check for the presence of a global
selection mask was incorrect.
Related: bug 407375, bug 407665

BACKPORT:krita/4.2

M  +15   -3    libs/image/kis_group_layer.cc
M  +12   -0    libs/image/kis_image.cc
M  +12   -0    libs/image/kis_image.h
M  +1    -0    libs/ui/kis_mimedata.cpp
M  +5    -2    libs/ui/tool/kis_selection_tool_helper.cpp

https://invent.kde.org/kde/krita/commit/ad31625eae8f9701e5de65b11d79065139ce3741
Comment 7 Halla Rempt 2019-05-21 07:23:38 UTC
Git commit 1b932bd47ad00202e9d22c37396582c34bd2b4de by Boudewijn Rempt, on behalf of Dmitry Kazakov.
Committed on 21/05/2019 at 07:23.
Pushed by rempt into branch 'krita/4.2'.

One more try to fix restriction for adding masks to the root layer

We should not allow adding a mask to normal root layers. It makes
painters confused. But for clipboard contents is it perfectly okay,
so just add an option for it.

It the previous version the check for the presence of a global
selection mask was incorrect.
Related: bug 407375, bug 407665

BACKPORT:krita/4.2

M  +15   -3    libs/image/kis_group_layer.cc
M  +12   -0    libs/image/kis_image.cc
M  +12   -0    libs/image/kis_image.h
M  +1    -0    libs/ui/kis_mimedata.cpp
M  +5    -2    libs/ui/tool/kis_selection_tool_helper.cpp

https://invent.kde.org/kde/krita/commit/1b932bd47ad00202e9d22c37396582c34bd2b4de