Bug 392183 - Running python script duplicating layer and applying filter crashes Scripter
Summary: Running python script duplicating layer and applying filter crashes Scripter
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Scripting (show other bugs)
Version: 4.0
Platform: Other Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Halla Rempt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-22 15:07 UTC by cyaoeu
Modified: 2018-09-07 14:26 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cyaoeu 2018-03-22 15:07:09 UTC
Running python script duplicating layer and applying filter crashes Scripter (or Krita, not sure). On Win8 and Krita is version 4.0.0.

Script is this:

import sys
from krita import *

doc = Krita.instance().documents()[0]
height = doc.height()
width = doc.width()
newlayer = doc.topLevelNodes()[0].duplicate()
root = doc.rootNode()
newthing = root.addChildNode(newlayer, None)
newlayer.setName("Test")
myconfig = InfoObject()
myconfig.setProperty("s", -100)
filter = Krita.instance().filter("hsvadjustment")
filter.setConfiguration(myconfig)
filter.startFilter(newlayer, 0, 0, width, height)
Comment 1 wolthera 2018-03-22 15:08:12 UTC
Can confirm this on KDE Neon based on Ubuntu 16.04

-------------------------GDB backtrace --------------------------
Thread 20 (Thread 0x7fff9fdad700 (LWP 18816)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007ffff518b335 in QBasicMutex::lockInternal() ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#2  0x00007ffff518b397 in QMutex::lock() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#3  0x00007ffff51945d8 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007fffee3006ba in start_thread (arg=0x7fff9fdad700) at pthread_create.c:333
#5  0x00007ffff488b41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 19 (Thread 0x7fffa51fe700 (LWP 18815)):
#0  clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:81
#1  0x00007fffee2ff14a in create_thread (pd=pd@entry=0x7fff9fdad700, 
    attr=attr@entry=0x7fffa51fd7b0, stopped_start=<optimized out>, stopped_start@entry=false, 
    stackaddr=<optimized out>, thread_ran=0x7fffa51fd6cf)
    at ../sysdeps/unix/sysv/linux/createthread.c:102
#2  0x00007fffee300e84 in __pthread_create_2_1 (newthread=<optimized out>, 
    attr=<optimized out>, start_routine=<optimized out>, arg=<optimized out>)
    at pthread_create.c:679
#3  0x00007ffff5193be6 in QThread::start(QThread::Priority) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007ffff518fdc4 in QThreadPoolPrivate::startThread(QRunnable*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff519148b in QThreadPoolPrivate::tryStart(QRunnable*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007ffff5191acc in QThreadPool::start(QRunnable*, int) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007ffff24fe9f8 in KisUpdaterContext::addStrokeJob (this=this@entry=0x153fd640, 
    strokeJob=0xcfbd630) at /home/wolthera/krita/src/libs/image/kis_updater_context.cpp:177
#8  0x00007ffff2507921 in KisStrokesQueue::processOneJob (this=this@entry=0x153fd630, 

    updaterContext=..., externalJobsPending=externalJobsPending@entry=false)
    at /home/wolthera/krita/src/libs/image/kis_strokes_queue.cpp:704
#9  0x00007ffff25079ce in KisStrokesQueue::processQueue (this=0x153fd630, updaterContext=..., 
    externalJobsPending=<optimized out>)
    at /home/wolthera/krita/src/libs/image/kis_strokes_queue.cpp:559
#10 0x00007ffff2510338 in KisUpdateScheduler::processQueues (this=0x137270a8)
    at /home/wolthera/krita/src/libs/image/kis_update_scheduler.cpp:413
#11 0x00007ffff539e489 in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#12 0x00007ffff24fd9e0 in KisUpdaterContext::slotJobFinished (this=<optimized out>)
    at /home/wolthera/krita/src/libs/image/kis_updater_context.cpp:252
---Type <return> to continue, or q <return> to quit---
#13 0x00007ffff539e489 in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007ffff265e11c in KisUpdateJobItem::sigJobFinished (this=0x1371d2d0)
    at /home/wolthera/krita/build/libs/image/moc_kis_update_job_item.cpp:164
#15 KisUpdateJobItem::run (this=0x1371d2d0)
    at /home/wolthera/krita/build/libs/image/../../../src/libs/image/kis_update_job_item.h:99
#16 0x00007ffff5190b37 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#17 0x00007ffff51946eb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007fffee3006ba in start_thread (arg=0x7fffa51fe700) at pthread_create.c:333
#19 0x00007ffff488b41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 6 (Thread 0x7fffb8604700 (LWP 17641)):
#0  0x00007ffff487f74d in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007fffeca9838c in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fffeca9849c in g_main_context_iteration ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff53c85af in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007ffff536f64a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff518f554 in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007fffd5adea35 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#7  0x00007ffff51946eb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007fffee3006ba in start_thread (arg=0x7fffb8604700) at pthread_create.c:333
#9  0x00007ffff488b41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 5 (Thread 0x7fffb7e03700 (LWP 17639)):
#0  0x00007ffff485030d in nanosleep () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007ffff53c7f2d in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#2  0x00007ffff5193a78 in QThread::msleep(unsigned long) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#3  0x00007ffff24213ca in KisTileDataSwapper::run (
    this=0x7ffff291ff80 <(anonymous namespace)::Q_QGS_s_instance::innerFunction()::holder+64>)
    at /home/wolthera/krita/src/libs/image/tiles3/swap/kis_tile_data_swapper.cpp:97
#4  0x00007ffff51946eb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007fffee3006ba in start_thread (arg=0x7fffb7e03700) at pthread_create.c:333
#6  0x00007ffff488b41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 3 (Thread 0x7fffd07fd700 (LWP 17633)):
#0  0x00007ffff487f74d in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007fffeca9838c in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#2  0x00007fffeca9849c in g_main_context_iteration ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff53c85af in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007ffff536f64a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff518f554 in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007fffee52c2c5 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
#7  0x00007ffff51946eb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007fffee3006ba in start_thread (arg=0x7fffd07fd700) at pthread_create.c:333
#9  0x00007ffff488b41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 2 (Thread 0x7fffdcbd5700 (LWP 17632)):
#0  0x00007ffff487f74d in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007ffff2b7dc62 in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#2  0x00007ffff2b7f8d7 in xcb_wait_for_event () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#3  0x00007fffdf12dce9 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#4  0x00007ffff51946eb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007fffee3006ba in start_thread (arg=0x7fffdcbd5700) at pthread_create.c:333
#6  0x00007ffff488b41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7ffff7f06900 (LWP 17627)):
#0  0x0000000000000000 in ?? ()
#1  0x00007fffb4154b45 in Filter::~Filter (this=0xfe43160, __in_chrg=<optimized out>)
    at /home/wolthera/krita/src/libs/libkis/Filter.cpp:54
#2  0x00007fffb4154ba9 in Filter::~Filter (this=0xfe43160, __in_chrg=<optimized out>)
    at /home/wolthera/krita/src/libs/libkis/Filter.cpp:56
#3  0x00007fffaf97745e in release_Filter (sipCppV=0xfe43160)
    at /home/wolthera/krita/build/plugins/extensions/pykrita/sip/./krita/sipkritapart0.cpp:25085
#4  0x00007fffafbeede9 in forgetObject (sw=sw@entry=0x7fff9ea47948) at siplib.c:12011
#5  0x00007fffafbeee09 in sipWrapper_dealloc (self=0x7fff9ea47948) at siplib.c:11560
#6  0x00007fffb442e921 in subtype_dealloc (self=<Filter at remote 0x7fff9ea47948>)
    at ../Objects/typeobject.c:1208
#7  0x00007fffb4454ac7 in free_keys_object (keys=0xf9c8260) at ../Objects/dictobject.c:354
#8  dict_dealloc.lto_priv.401 (mp=0x7fffa5dead08) at ../Objects/dictobject.c:1607
Python Exception <class 'RuntimeError'> Type does not have a target.: 
#9  0x00007fffb446e219 in frame_dealloc.lto_priv.363 (f=) at ../Objects/frameobject.c:431
#10 0x00007fffb45e6697 in _PyEval_EvalCodeWithName.lto_priv.1742 (_co=<optimized out>, 
    globals=<optimized out>, locals=<optimized out>, args=<optimized out>, argcount=1, kws=0x0, 
    kwcount=0, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name=0x0, qualname=0x0)
    at ../Python/ceval.c:4029
#11 0x00007fffb45e6d83 in PyEval_EvalCodeEx (_co=<optimized out>, globals=<optimized out>, 
---Type <return> to continue, or q <return> to quit---
    locals=<optimized out>, args=<optimized out>, argcount=<optimized out>, 
    kws=<optimized out>, kwcount=0, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0)
    at ../Python/ceval.c:4039
#12 0x00007fffb446ead8 in function_call.lto_priv.368 (func=<function at remote 0x7fff9ea34378>, 
Python Exception <class 'RuntimeError'> Type does not have a target.: 
    arg=, kw=0x0) at ../Objects/funcobject.c:627
#13 0x00007fffb452354e in PyObject_Call (func=<function at remote 0x7fff9ea34378>, 
    arg=<optimized out>, kw=<optimized out>) at ../Objects/abstract.c:2165
#14 0x00007fffb45c1aec in method_call.lto_priv.274 (func=<function at remote 0x7fff9ea34378>, 
Python Exception <class 'RuntimeError'> Type does not have a target.: 
    arg=, kw=0x0) at ../Objects/classobject.c:330
#15 0x00007fffb452354e in PyObject_Call (func=<method at remote 0x7fffcc1057c8>, 
    arg=<optimized out>, kw=<optimized out>) at ../Objects/abstract.c:2165
#16 0x00007fffb45e5937 in PyEval_CallObjectWithKeywords (
    func=<method at remote 0x7fffcc1057c8>, arg=(), kw=<optimized out>)
    at ../Python/ceval.c:4580
#17 0x00007fffaf664c05 in ?? ()
   from /usr/lib/python3/dist-packages/PyQt5/QtCore.cpython-35m-x86_64-linux-gnu.so
#18 0x00007fffaf665138 in ?? ()
   from /usr/lib/python3/dist-packages/PyQt5/QtCore.cpython-35m-x86_64-linux-gnu.so
#19 0x00007fffaf6653c0 in ?? ()
   from /usr/lib/python3/dist-packages/PyQt5/QtCore.cpython-35m-x86_64-linux-gnu.so
#20 0x00007fffaf665dd7 in ?? ()
   from /usr/lib/python3/dist-packages/PyQt5/QtCore.cpython-35m-x86_64-linux-gnu.so
#21 0x00007ffff539e5f4 in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#22 0x00007ffff60ab4a2 in QAction::triggered(bool) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#23 0x00007ffff60adc10 in QAction::activate(QAction::ActionEvent) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#24 0x00007ffff61aa900 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#25 0x00007ffff61aaa3d in QAbstractButton::mouseReleaseEvent(QMouseEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#26 0x00007ffff62870da in QToolButton::mouseReleaseEvent(QMouseEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#27 0x00007ffff60f0f88 in QWidget::event(QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#28 0x00007ffff62871b9 in QToolButton::event(QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#29 0x00007ffff60b1acc in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#30 0x00007ffff60ba03b in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
---Type <return> to continue, or q <return> to quit---
#31 0x00007ffff77d2357 in KisApplication::notify (this=<optimized out>, receiver=0x153407b0, 
    event=0x7fffffffd0c0) at /home/wolthera/krita/src/libs/ui/KisApplication.cpp:620
#32 0x00007ffff53713c8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#33 0x00007ffff60b89df in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#34 0x00007ffff610af4d in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#35 0x00007ffff610d97b in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#36 0x00007ffff60b1acc in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#37 0x00007ffff60b9417 in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#38 0x00007ffff77d2357 in KisApplication::notify (this=<optimized out>, receiver=0xf83a3a0, 
    event=0x7fffffffd540) at /home/wolthera/krita/src/libs/ui/KisApplication.cpp:620
#39 0x00007ffff53713c8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#40 0x00007ffff5909ef0 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#41 0x00007ffff590be45 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#42 0x00007ffff58e58fb in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#43 0x00007fffdf1b01ab in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#44 0x00007ffff536f64a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#45 0x00007ffff5378854 in QCoreApplication::exec() ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#46 0x00000000004054d3 in main (argc=1, argv=0x7fffffffde58)
    at /home/wolthera/krita/src/krita/main.cc:349
(gdb)
Comment 2 Alvin Wong 2018-03-23 14:56:58 UTC
I got the crash with the windows and appimage release, but not with a local master build on KDE Neon...

The local build runs on sip 4.19.8, could be related?
Comment 3 Halla Rempt 2018-08-14 08:52:01 UTC
Git commit ddfc126edc53880953a433cc14a5d03132c976cd by Boudewijn Rempt.
Committed on 14/08/2018 at 08:51.
Pushed by rempt into branch 'master'.

Fix memory management of the Filter's InfoObject

M  +1    -1    plugins/extensions/pykrita/sip/krita/Filter.sip

https://commits.kde.org/krita/ddfc126edc53880953a433cc14a5d03132c976cd
Comment 4 Halla Rempt 2018-09-07 14:26:14 UTC
Git commit 052a44734b2a6d34f168346a7fe33cb15e2e7a39 by Boudewijn Rempt.
Committed on 07/09/2018 at 12:37.
Pushed by rempt into branch 'krita/4.1'.

Fix memory management of the Filter's InfoObject

M  +1    -1    plugins/extensions/pykrita/sip/krita/Filter.sip

https://commits.kde.org/krita/052a44734b2a6d34f168346a7fe33cb15e2e7a39