Bug 403436 - channel[].visible() always returns False
Summary: channel[].visible() always returns False
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Scripting (show other bugs)
Version: 4.1.7
Platform: Microsoft Windows Microsoft Windows
: NOR minor
Target Milestone: ---
Assignee: Victor Wåhlström
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2019-01-20 16:36 UTC by Kapyia
Modified: 2019-05-05 16:13 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 Kapyia 2019-01-20 16:36:29 UTC
SUMMARY
Checking for a channel's visibility using the visible() function in Python always returns False.


STEPS TO REPRODUCE
1. Create a new document in Krita


2. Run the following script in the Scripter tool:

###
from krita import *

doc = Krita.instance().activeDocument()
channel = doc.activeNode().channels()[0]

channel.setVisible(True)
print(channel.visible())
doc.refreshProjection()
###


OBSERVED RESULT
Output is always 'False'. Setting a  channel's visibility works, but the flag doesn't seem to be updated. Additionally, changing a channel's visibility using setVisible() isn't reflected in the Channels docker.


EXPECTED RESULT
Output from visible() should reflect the visibility of the channel.


OS
Windows 10
Comment 1 Kuntal Majumder 2019-01-20 16:44:14 UTC
Reproducing the above steps, ends up with an assert in my case,

ASSERT: "uint(i) < uint(size())" in file /usr/include/qt5/QtCore/qbitarray.h, line 123

when print(channel.visible()) is run

OS : Gentoo
Krita : 4.2-prealpha (git c4d9588)
Comment 2 Kapyia 2019-01-20 16:59:43 UTC
Disregard the line about the Channels docker. This script manipulates the individual layer's channels, so there's no reason for the visibility status in the Channels docker to be affected.
Comment 3 Rebecca Breu 2019-01-20 17:55:02 UTC
I can confirm Kapyia's behaviour (visible() returns always False) with the 4.1.7 appimage and the Jan 18 nightly build (git 4f95062). I get Kuntal Majumder's assertion error with a current docker build (git 494f604d7309ec7600512b44600601d16c7ec849). (I'm on Debian Stable).



#0  0x00007ffff366bc37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff366f028 in __GI_abort () at abort.c:89
#2  0x00007ffff3fc928e in QMessageLogger::fatal(char const*, ...) const ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Core.so.5
#3  0x00007ffff3fc45a6 in qt_assert(char const*, char const*, int) () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Core.so.5
#4  0x00007ffff66d1289 in QBitArray::testBit (this=0x7fffffffc4e0, i=0)
    at /home/appimage/appimage-workspace/deps/usr/include/QtCore/qbitarray.h:120
#5  0x00007fffb9c8806b in Channel::visible (this=0x92e5060) at /home/appimage/persistent/krita/libs/libkis/Channel.cpp:76
#6  0x00007fffb93087e2 in meth_Channel_visible (sipSelf=0x7fffb4040f78, sipArgs=0x7fffc80e3048)
    at /home/appimage/appimage-workspace/krita-build/plugins/extensions/pykrita/sip/./krita/sipkritapart0.cpp:31831
#7  0x00007fffb9fd7559 in PyCFunction_Call (func=func@entry=0x7fffb4a1b438, args=args@entry=0x7fffc80e3048, kwds=kwds@entry=0x0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/methodobject.c:109
#8  0x00007fffba0712b3 in call_function (oparg=<optimized out>, pp_stack=0x7fffffffc670)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:4705
#9  PyEval_EvalFrameEx (f=f@entry=0x7fffb4a8d1f0, throwflag=throwflag@entry=0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:3236
#10 0x00007fffba073636 in _PyEval_EvalCodeWithName (_co=_co@entry=0x7fffb4040db0, globals=globals@entry=0x7fffb4029e48, 
    locals=locals@entry=0x7fffb4029e48, args=args@entry=0x0, argcount=argcount@entry=0, kws=kws@entry=0x0, kwcount=kwcount@entry=0, 
    defs=defs@entry=0x0, defcount=defcount@entry=0, kwdefs=kwdefs@entry=0x0, closure=closure@entry=0x0, name=name@entry=0x0, 
    qualname=qualname@entry=0x0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:4018
#11 0x00007fffba073728 in PyEval_EvalCodeEx (_co=_co@entry=0x7fffb4040db0, globals=globals@entry=0x7fffb4029e48, 
    locals=locals@entry=0x7fffb4029e48, args=args@entry=0x0, argcount=argcount@entry=0, kws=kws@entry=0x0, kwcount=kwcount@entry=0, 
    defs=defs@entry=0x0, defcount=defcount@entry=0, kwdefs=kwdefs@entry=0x0, closure=closure@entry=0x0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:4039
#12 0x00007fffba07376b in PyEval_EvalCode (co=co@entry=0x7fffb4040db0, globals=globals@entry=0x7fffb4029e48, 
    locals=locals@entry=0x7fffb4029e48)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:777
#13 0x00007fffba066fed in builtin_exec_impl (module=<optimized out>, locals=0x7fffb4029e48, globals=0x7fffb4029e48, source=0x7fffb4040db0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/bltinmodule.c:957
#14 builtin_exec (module=<optimized out>, args=<optimized out>)
--Type <RET> for more, q to quit, c to continue without paging--
   /src/ext_python/Python/clinic/bltinmodule.c.h:275
#15 0x00007fffb9fd7559 in PyCFunction_Call (func=func@entry=0x7fffc811b240, args=args@entry=0x7fffb4033c08, kwds=kwds@entry=0x0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/methodobject.c:109
#16 0x00007fffba0712b3 in call_function (oparg=<optimized out>, pp_stack=0x7fffffffc9f0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:4705
#17 PyEval_EvalFrameEx (f=f@entry=0x11cb8bf8, throwflag=throwflag@entry=0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:3236
#18 0x00007fffba073636 in _PyEval_EvalCodeWithName (_co=0x7fffb4037780, globals=<optimized out>, locals=locals@entry=0x0, 
    args=args@entry=0x7fffb52ff488, argcount=1, kws=kws@entry=0x0, kwcount=kwcount@entry=0, defs=defs@entry=0x0, 
    defcount=defcount@entry=0, kwdefs=kwdefs@entry=0x0, closure=closure@entry=0x0, name=name@entry=0x0, qualname=qualname@entry=0x0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:4018
#19 0x00007fffba073728 in PyEval_EvalCodeEx (_co=<optimized out>, globals=<optimized out>, locals=locals@entry=0x0, 
    args=args@entry=0x7fffb52ff488, argcount=<optimized out>, kws=kws@entry=0x0, kwcount=kwcount@entry=0, defs=defs@entry=0x0, 
    defcount=defcount@entry=0, kwdefs=0x0, closure=0x0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:4039
#20 0x00007fffb9fb47c6 in function_call (func=0x7fffb4028f28, arg=0x7fffb52ff470, kw=0x0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/funcobject.c:627
#21 0x00007fffb9f8320a in PyObject_Call (func=func@entry=0x7fffb4028f28, arg=arg@entry=0x7fffb52ff470, kw=kw@entry=0x0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/abstract.c:2165
#22 0x00007fffb9f9bd2d in method_call (func=0x7fffb4028f28, arg=0x7fffb52ff470, kw=0x0)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/classobject.c:330
#23 0x00007fffb9f8320a in PyObject_Call (func=func@entry=0x7fffc80d1688, arg=arg@entry=0x7fffc80e3048, kw=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Objects/abstract.c:2165
#24 0x00007fffba069157 in PyEval_CallObjectWithKeywords (func=0x7fffc80d1688, arg=0x7fffc80e3048, kw=<optimized out>)
    at /home/appimage/appimage-workspace/deps-build/ext_python/ext_python-prefix/src/ext_python/Python/ceval.c:4580
#25 0x00007fffb8fb0d25 in PyQtSlot::call(_object*, _object*) const ()
   from /home/appimage/appimage-workspace/deps/usr/lib/python3.5/site-packages/PyQt5/QtCore.so
#26 0x00007fffb8fb1230 in PyQtSlot::invoke(void**, _object*, void*, bool) const ()
   from /home/appimage/appimage-workspace/deps/usr/lib/python3.5/site-packages/PyQt5/QtCore.so
#27 0x00007fffb8fb14ab in PyQtSlotProxy::unislot(void**) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/python3.5/site-packages/PyQt5/QtCore.so
--Type <RET> for more, q to quit, c to continue without paging--
#28 0x00007fffb8fb2287 in PyQtSlotProxy::qt_metacall(QMetaObject::Call, int, void**) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/python3.5/site-packages/PyQt5/QtCore.so
#29 0x00007ffff41d23b4 in QMetaObject::activate(QObject*, int, int, void**) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Core.so.5
#30 0x00007ffff4be4ce2 in QAction::triggered(bool) () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#31 0x00007ffff4be74ad in QAction::activate(QAction::ActionEvent) () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#32 0x00007ffff4cdc9ed in ?? () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#33 0x00007ffff4cdcb25 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#34 0x00007ffff4dae5aa in QToolButton::mouseReleaseEvent(QMouseEvent*) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#35 0x00007ffff4c27067 in QWidget::event(QEvent*) () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#36 0x00007ffff4dae689 in QToolButton::event(QEvent*) () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#37 0x00007ffff4beb20c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#38 0x00007ffff4bf25cc in QApplication::notify(QObject*, QEvent*) () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#39 0x00007ffff6ae9b5e in KisApplication::notify (this=0x7fffffffe330, receiver=0xcb8bd00, event=0x7fffffffd570)
    at /home/appimage/persistent/krita/libs/ui/KisApplication.cpp:608
#40 0x00007ffff41a79b5 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Core.so.5
#41 0x00007ffff4bf1449 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5

#42 0x00007ffff4c3f5cf in ?? () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#43 0x00007ffff4c41ae3 in ?? () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#44 0x00007ffff4beb20c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#45 0x00007ffff4bf1f30 in QApplication::notify(QObject*, QEvent*) () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Widgets.so.5
#46 0x00007ffff6ae9b5e in KisApplication::notify (this=0x7fffffffe330, receiver=0xcadf290, event=0x7fffffffda50)
    at /home/appimage/persistent/krita/libs/ui/KisApplication.cpp:608
#47 0x00007ffff41a79b5 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Core.so.5
--Type <RET> for more, q to quit, c to continue without paging--
#48 0x00007ffff45f6afd in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Gui.so.5
#49 0x00007ffff45f86b5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Gui.so.5
#50 0x00007ffff45d70fb in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Gui.so.5
#51 0x00007fffe7c2e99b in ?? () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5XcbQpa.so.5
#52 0x00007ffff41a5f4b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Core.so.5
#53 0x00007ffff41ae7c4 in QCoreApplication::exec() () from /home/appimage/appimage-workspace/deps/usr/lib/libQt5Core.so.5
#54 0x000000000040add9 in main (argc=1, argv=0x7fffffffe498) at /home/appimage/persistent/krita/krita/main.cc:459
Comment 4 wolthera 2019-04-08 15:35:30 UTC
with rebecca's backtrace this can be set to confirmed.
Comment 5 Victor Wåhlström 2019-05-05 16:13:26 UTC
Git commit 84eb32f2b99892e6afff09936ffc30dd57ca3fb6 by Victor Wåhlström.
Committed on 05/05/2019 at 16:07.
Pushed by victorw into branch 'master'.

Fix crash when checking if a channel is visible

Documentation states that if channelFlags is empty, then all channels are considered active.

M  +4    -2    libs/libkis/Channel.cpp

https://invent.kde.org/kde/krita/commit/84eb32f2b99892e6afff09936ffc30dd57ca3fb6