Bug 419093 - call to Node.mergeDown() exits krita
Summary: call to Node.mergeDown() exits krita
Status: RESOLVED WORKSFORME
Alias: None
Product: krita
Classification: Applications
Component: Scripting (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: macOS (DMG) macOS
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-22 05:49 UTC by Manga Tengu
Modified: 2022-05-27 04:35 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
a script that tries to mergeDown a layer (543 bytes, text/x-python-script)
2020-03-22 05:49 UTC, Manga Tengu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Manga Tengu 2020-03-22 05:49:53 UTC
Created attachment 126936 [details]
a script that tries to mergeDown a layer

When I call mergeDown() on a Node with the scripting console, krita shuts down abruptly

STEPS
Load a file (tried with jpg and png)
edit the (attached) script to load it
run the script 

OBSERVED RESULT
krita shuts down. If you comment the mergeDown call, krita won't shut down

EXPECTED RESULT
The layer is merged

SOFTWARE/OS VERSIONS

Krita 4.3.0-prealpha git 9dffafb
macOS: Catalina 10.15.3 (19D76)
Comment 1 Manga Tengu 2020-03-22 05:54:06 UTC
Comment on attachment 126936 [details]
a script that tries to mergeDown a layer

>from krita import *
>
>doc = Application.openDocument("PathToImage")
>window = Application.activeWindow()
>view = window.addView(doc)
>window.showView(view)
>paintLayer = doc.createNode("Background1", "paintLayer")
>i = InfoObject()
>i.setProperty("color", "white")
>s = Selection()
>s.select(0, 0, doc.width(), doc.height(), 255)
>fillLayer = doc.createFillLayer("Background2", "color", i, s)
>root = doc.rootNode()
>children = root.childNodes()
>root.setChildNodes([fillLayer, paintLayer, children[0]])
>children = root.childNodes()
>children[1].mergeDown()
Comment 2 Rebecca Breu 2020-03-22 09:36:00 UTC
I can confirm this. It's only happening with the current 4.3. master, not with 4.2.8 and 4.2.9 beta. I'm getting two safe asserts and a segfault:

SAFE ASSERT (krita): "!m_d->waitingOnImages.contains(image)" in file /home/appimage/persistent/krita/libs/image/KisBusyWaitBroker.cpp, line 64
SAFE ASSERT (krita): "m_d->waitingOnImages.contains(image)" in file /home/appimage/persistent/krita/libs/image/KisBusyWaitBroker.cpp, line 80

Thread 1 "krita" received signal SIGSEGV, Segmentation fault.
Node::createNode (image=..., node=..., parent=parent@entry=0x0) at /home/appimage/persistent/krita/libs/libkis/Node.cpp:87
87	    if (node->inherits("KisGroupLayer")) {



(gdb) backtrace
#0  Node::createNode (image=..., node=..., parent=parent@entry=0x0) at /home/appimage/persistent/krita/libs/libkis/Node.cpp:87
#1  0x00007fffc4632bc7 in Node::mergeDown (this=0xe999090) at /home/appimage/persistent/krita/libs/libkis/Node.cpp:608
#2  0x00007fffbbd9fae3 in meth_Node_mergeDown (sipSelf=0x7fffb66650d0, sipArgs=<optimized out>)
    at /home/appimage/appimage-workspace/krita-build/plugins/extensions/pykrita/sip/./krita/sipkritapart0.cpp:20073
#3  0x00007fffc49016fa in cfunction_call_varargs (kwargs=<optimized out>, args=0x7fffcc06d040, func=0x7fffb71d9b80)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/call.c:757
#4  PyCFunction_Call (func=0x7fffb71d9b80, args=0x7fffcc06d040, kwargs=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/call.c:772
#5  0x00007fffc48ff311 in _PyObject_MakeTpCall (callable=0x7fffb71d9b80, args=<optimized out>, nargs=<optimized out>, keywords=0x0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/call.c:159
#6  0x00007fffc48d5827 in _PyObject_Vectorcall (kwnames=<optimized out>, nargsf=<optimized out>, args=<optimized out>,
    callable=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Include/cpython/abstract.h:125
#7  call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=0x6cdc000)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:4987
#8  _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:3469
#9  0x00007fffc49efeaa in _PyEval_EvalCodeWithName (_co=_co@entry=0x7fffb6655240, globals=globals@entry=0x7fffb6634180,
    locals=locals@entry=0x7fffb6634180, args=args@entry=0x0, argcount=argcount@entry=0, kwnames=kwnames@entry=0x0, kwargs=0x0, kwcount=0,
    kwstep=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name=0x0, qualname=0x0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:4298
#10 0x00007fffc49f005e in PyEval_EvalCodeEx (_co=_co@entry=0x7fffb6655240, globals=globals@entry=0x7fffb6634180,
    locals=locals@entry=0x7fffb6634180, args=args@entry=0x0, argcount=argcount@entry=0, kws=kws@entry=0x0, kwcount=0, defs=0x0,
    defcount=0, kwdefs=0x0, closure=0x0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:4327
#11 0x00007fffc49f008b in PyEval_EvalCode (co=co@entry=0x7fffb6655240, globals=globals@entry=0x7fffb6634180,
    locals=locals@entry=0x7fffb6634180)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:718
#12 0x00007fffc49ecaa9 in builtin_exec_impl (module=<optimized out>, locals=0x7fffb6634180, globals=0x7fffb6634180, source=0x7fffb6655240)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/bltinmodule.c:1033
#13 builtin_exec (module=<optimized out>, args=<optimized out>, nargs=<optimized out>)
--Type <RET> for more, q to quit, c to continue without paging--
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/clinic/bltinmodule.c.h:396
#14 0x00007fffc4949380 in cfunction_vectorcall_FASTCALL (func=func@entry=0x7fffcc03c590, args=<optimized out>, nargsf=nargsf@entry=2,
    kwnames=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/methodobject.c:421
#15 0x00007fffc490125f in PyVectorcall_Call (callable=0x7fffcc03c590, tuple=<optimized out>, kwargs=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/call.c:199
#16 0x00007fffc48d6308 in do_call_core (kwdict=0x7fffb6652e80, callargs=0x7fffb6653640, func=0x7fffcc03c590, tstate=0x6cdc000)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:5007
#17 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:3559
#18 0x00007fffc49efeaa in _PyEval_EvalCodeWithName (_co=0x7fffcc0449d0, globals=globals@entry=0x7fffcc04ef80, locals=locals@entry=0x0,
    args=<optimized out>, argcount=3, kwnames=0x0, kwargs=0x7fffb664d1e8, kwcount=0, kwstep=1, defs=0x0, defcount=0, kwdefs=0x0,
    closure=0x0, name=0x7fffcc045440, qualname=0x7fffcc045440)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:4298
#19 0x00007fffc48ff108 in _PyFunction_Vectorcall (func=<optimized out>, stack=<optimized out>, nargsf=<optimized out>,
    kwnames=<optimized out>) at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/call.c:435
#20 0x00007fffc48d5872 in _PyObject_Vectorcall (kwnames=<optimized out>, nargsf=<optimized out>, args=<optimized out>,
    callable=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Include/cpython/abstract.h:127
#21 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=0x6cdc000)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:4987
#22 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:3469
#23 0x00007fffc48cd680 in function_code_fastcall (co=<optimized out>, args=<optimized out>, nargs=2, globals=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/call.c:283
#24 0x00007fffc48d547a in _PyObject_Vectorcall (kwnames=<optimized out>, nargsf=<optimized out>, args=<optimized out>,
    callable=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Include/cpython/abstract.h:127
#25 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=0x6cdc000)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:4987
#26 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>)
--Type <RET> for more, q to quit, c to continue without paging--
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:3486
#27 0x00007fffc48cd680 in function_code_fastcall (co=<optimized out>, args=<optimized out>, nargs=2, globals=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/call.c:283
#28 0x00007fffc4902ef0 in _PyObject_Vectorcall (kwnames=0x0, nargsf=2, args=0x8bafc88, callable=0x7fffb6641550)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Include/cpython/abstract.h:127
#29 method_vectorcall (method=<optimized out>, args=0x8bafc90, nargsf=<optimized out>, kwnames=0x0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/classobject.c:60
#30 0x00007fffc48d5872 in _PyObject_Vectorcall (kwnames=<optimized out>, nargsf=<optimized out>, args=<optimized out>,
    callable=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Include/cpython/abstract.h:127
#31 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=0x6cdc000)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:4987
#32 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:3469
#33 0x00007fffc48cd680 in function_code_fastcall (co=<optimized out>, args=<optimized out>, nargs=1, globals=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/call.c:283
#34 0x00007fffc4902ea0 in _PyObject_Vectorcall (kwnames=0x0, nargsf=1, args=0x7fffffffcac8, callable=0x7fffb6641430)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Include/cpython/abstract.h:127
#35 method_vectorcall (method=method@entry=0x7fffc435ac40, args=0x7fffcc06d058, nargsf=nargsf@entry=0, kwnames=0x0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/classobject.c:67
#36 0x00007fffc490125f in PyVectorcall_Call (callable=0x7fffc435ac40, tuple=<optimized out>, kwargs=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/call.c:199
#37 0x00007fffbb852ee5 in PyQtSlot::call(_object*, _object*) const ()
   from /home/appimage/appimage-workspace/deps/usr/lib/python3.8/site-packages/PyQt5/QtCore.so
#38 0x00007fffbb853418 in PyQtSlot::invoke(void**, _object*, void*, bool) const ()
   from /home/appimage/appimage-workspace/deps/usr/lib/python3.8/site-packages/PyQt5/QtCore.so
#39 0x00007fffbb8536a0 in PyQtSlotProxy::unislot(void**) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/python3.8/site-packages/PyQt5/QtCore.so
#40 0x00007fffbb8541d7 in PyQtSlotProxy::qt_metacall(QMetaObject::Call, int, void**) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/python3.8/site-packages/PyQt5/QtCore.so
#41 0x00007ffff3e9b844 in QMetaObject::activate(QObject*, int, int, void**) ()
--Type <RET> for more, q to quit, c to continue without paging--
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Core.so.5
#42 0x00007ffff490a382 in QAction::triggered(bool) () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#43 0x00007ffff490c910 in QAction::activate(QAction::ActionEvent) () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#44 0x00007ffff49fd310 in ?? () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#45 0x00007ffff49fd44d in QAbstractButton::mouseReleaseEvent(QMouseEvent*) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#46 0x00007ffff4ae7ada in QToolButton::mouseReleaseEvent(QMouseEvent*) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#47 0x00007ffff49511c8 in QWidget::event(QEvent*) () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#48 0x00007ffff4ae7bb9 in QToolButton::event(QEvent*) () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#49 0x00007ffff49108dc in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#50 0x00007ffff4918360 in QApplication::notify(QObject*, QEvent*) () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#51 0x00007ffff6d31a57 in KisApplication::notify (this=<optimized out>, receiver=0x8b880b0, event=0x7fffffffd430)
    at /home/appimage/persistent/krita/libs/ui/KisApplication.cpp:705
#52 0x00007ffff3e6e338 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Core.so.5
#53 0x00007ffff4917452 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#54 0x00007ffff496af4a in ?? () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#55 0x00007ffff496de83 in ?? () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#56 0x00007ffff49108dc in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#57 0x00007ffff4917fb8 in QApplication::notify(QObject*, QEvent*) () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5

#58 0x00007ffff6d31a57 in KisApplication::notify (this=<optimized out>, receiver=0x8b99c50, event=0x7fffffffd900)
    at /home/appimage/persistent/krita/libs/ui/KisApplication.cpp:705
#59 0x00007ffff3e6e338 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Core.so.5
#60 0x00007ffff42e4897 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Gui.so.5
#61 0x00007ffff42e5e65 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) ()
--Type <RET> for more, q to quit, c to continue without paging--
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Gui.so.5
#62 0x00007ffff42c216b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Gui.so.5
#63 0x00007fffe630caaa in ?? () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5XcbQpa.so.5
#64 0x00007fffec79a197 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#65 0x00007fffec79a3f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#66 0x00007fffec79a49c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#67 0x00007ffff3ec771f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Core.so.5
#68 0x00007ffff3e6c5fa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Core.so.5
#69 0x00007ffff3e75644 in QCoreApplication::exec() () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Core.so.5
#70 0x0000000000407edd in main (argc=1, argv=0x7fffffffe428) at /home/appimage/persistent/krita/krita/main.cc:597
Comment 3 Scott Petrovic 2020-07-31 14:35:24 UTC
There might need to be some more digging with this. There are a lot of different things going on with the script. I don't know if it is the mergeDown() that is giving issues. I am running this script that merges a layer down and it seems to work ok...

from krita import *

# create document and show in view
doc = Krita.instance().createDocument(1280, 1024, "Document name", "RGBA", "U8", "", 300.0)
view = Krita.instance().activeWindow().addView(doc) # shows it in the application
window = Application.activeWindow()

# create nodes and add it to the layers stack
paintLayer = doc.createNode("Background1", "paintlayer")
paintLayerTwo = doc.createNode("Background2", "paintlayer")

root = doc.rootNode()
root.addChildNode(paintLayer, None)
root.addChildNode(paintLayerTwo, None)

# merge the top layer down
paintLayerTwo.mergeDown()
Comment 4 Manga Tengu 2020-07-31 17:27:54 UTC
There is a lot happening indeed, but the mergeDown() call is the one that triggers the bug as when it's commented everything else works.
If there is anything additional I can do please let me know !
Comment 5 Scott Petrovic 2020-07-31 17:34:15 UTC
The point I was trying to make is there is something going on with "children[1]" in your script that is giving it issues.

The mergeDown() is working in my script, so there must be some difference with how your script is set up that is giving it issues.

There could also be something with the "setChildNodes" that is not being set correctly that is causing the mergeDown to fail.

We just need to figure out what causes the situation where it fails.
Comment 6 Bug Janitor Service 2020-08-01 04:33:12 UTC
Thanks for your comment!

Automatically switching the status of this bug to REPORTED so that the KDE team
knows that the bug is ready to get confirmed.

In the future you may also do this yourself when providing needed information.
Comment 7 Halla Rempt 2022-04-27 13:43:30 UTC
I can no longer reproduce this crash with Krita 5.0.6 on macOS. Can anyone else?
Comment 8 Bug Janitor Service 2022-05-12 04:34:57 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 9 Bug Janitor Service 2022-05-27 04:35:53 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!