Bug 325661

Summary: Krita crashes when using certain combination of OpenColorIO settings
Product: krita Reporter: Ragnar Brynj├║lsson <ragtag>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Severity: crash CC: halla, ragtag
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Ragnar Brynj├║lsson 2013-10-05 11:25:46 UTC
Krita crashes when Input Color Space is set to vd8 and Display Device is set to sRGB in the LUT Management docker, using spi-vfc config and the OpenColorIO plugin. Doing it in the reverse order actually works (changing Display Device first), but then it will crash if you change Display Device a second time.

It crashes on certain other combinations too, but it always seems to happen when I switch the Display Device setting. It also happens when using different OCIO configs, as long as they have multiple Display Devices.

Reproducible: Always

Steps to Reproduce:
1.Compile Krita with OpenColorIO support (see related issue #325659 ).
2.Enable OpenColorIO and choose spi-vfx config from http://opencolorio.org/downloads.html
3.Enable OpenGL
4.Restart Krita
5.Create a new image
6.In the LUT Managmenet docker set:
- Input Color Space to vd8
- Display Device to sRGB
Actual Results:  
Krita crashes.

Expected Results:  
That color space would change correctly.

Compiled on Ubuntu 12.04 LTS 64-bit.
Comment 1 Halla Rempt 2013-12-19 10:46:31 UTC
I wonder whether this isn't a bug in ocio, actually...

Thread 1 (Thread 0x7f0c15dbd8c0 (LWP 24006)):
[KCrash Handler]
#5  0x00007f0c0cd8ceea in strlen () from /lib64/libc.so.6
#6  0x00007f0c0d693105 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) () from /usr/lib64/libstdc++.so.6
#7  0x00007f0bec7315db in OpenColorIO::v1::Config::getNumViews(char const*) const () from /usr/lib64/libOpenColorIO.so.1
#8  0x00007f0beca709c0 in LutDockerDock::refillViewCombobox (this=this@entry=0x413c360) at /home/boud/kde/src/2.8/krita/plugins/extensions/dockers/lut/lutdocker_dock.cpp:354
#9  0x00007f0beca73d68 in LutDockerDock::qt_static_metacall (_o=0x413c360, _c=<optimized out>, _id=12, _a=0x7ffffd5ec610) at /home/boud/kde/build/2.8/krita/plugins/extensions/dockers/lut/lutdocker_dock.moc:84
#10 0x00007f0c0dee5d68 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#11 0x00007f0c0ef24301 in QComboBox::currentIndexChanged(int) () from /usr/lib64/libQtGui.so.4
#12 0x00007f0c0ef24361 in ?? () from /usr/lib64/libQtGui.so.4
#13 0x00007f0c0ef2460c in ?? () from /usr/lib64/libQtGui.so.4
#14 0x00007f0c0ef24756 in ?? () from /usr/lib64/libQtGui.so.4
#15 0x00007f0c0dee5d68 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#16 0x00007f0c0f1a93f2 in ?? () from /usr/lib64/libQtGui.so.4
#17 0x00007f0c0ef20014 in ?? () from /usr/lib64/libQtGui.so.4
#18 0x00007f0c0ded2216 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4
#19 0x00007f0c0eb5f88c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#20 0x00007f0c0eb65fad in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#21 0x00007f0c145ce947 in KoApplication::notify (this=<optimized out>, receiver=0x41a2fb0, event=0x7ffffd5ecd40) at /home/boud/kde/src/2.8/libs/main/KoApplication.cpp:549
#22 0x00007f0c0ded20ad in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4
#23 0x00007f0c0eb65763 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib64/libQtGui.so.4
#24 0x00007f0c0ebd72ac in ?? () from /usr/lib64/libQtGui.so.4
#25 0x00007f0c0ebd59ec in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib64/libQtGui.so.4
#26 0x00007f0c0ebfd1f0 in ?? () from /usr/lib64/libQtGui.so.4
#27 0x00007f0c0ded0d0f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#28 0x00007f0c0ded1005 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#29 0x00007f0c0ded613b in QCoreApplication::exec() () from /usr/lib64/libQtCore.so.4
#30 0x00007f0c15791b45 in kdemain (argc=<optimized out>, argv=<optimized out>) at /home/boud/kde/src/2.8/krita/main.cc:99
#31 0x00007f0c0cd2bbe5 in __libc_start_main () from /lib64/libc.so.6
#32 0x00000000004009f1 in _start () at ../sysdeps/x86_64/start.S:122
Comment 2 Halla Rempt 2013-12-19 11:05:01 UTC
Memcheck output:

==26346== Invalid read of size 8
==26346==    at 0x3184E543: OpenColorIO::v1::Config::getDisplay(int) const (basic_string.h:293)
==26346==    by 0x3158EBA3: LutDockerDock::refillViewCombobox() (lutdocker_dock.cpp:360)
==26346==    by 0x31593977: LutDockerDock::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (lutdocker_dock.moc:84)
==26346==    by 0xC985D67: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib64/libQtCore.so.4.8.5)
==26346==    by 0xB98B300: QComboBox::currentIndexChanged(int) (in /usr/lib64/libQtGui.so.4.8.5)
==26346==    by 0xB98B360: ??? (in /usr/lib64/libQtGui.so.4.8.5)
==26346==    by 0xB98B60B: ??? (in /usr/lib64/libQtGui.so.4.8.5)
==26346==    by 0xB98B755: ??? (in /usr/lib64/libQtGui.so.4.8.5)
==26346==    by 0xC985D67: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib64/libQtCore.so.4.8.5)
==26346==    by 0xBC103F1: ??? (in /usr/lib64/libQtGui.so.4.8.5)
==26346==    by 0xB987013: ??? (in /usr/lib64/libQtGui.so.4.8.5)
==26346==    by 0xC972215: QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) (in /usr/lib64/libQtCore.so.4.8.5)
==26346==  Address 0x3d86b278 is 8 bytes before a block of size 128 alloc'd
==26346==    at 0x4C27D49: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==26346==    by 0xC89FC70: QMapData::createData(int) (in /usr/lib64/libQtCore.so.4.8.5)
==26346==    by 0x588F99A: QMap<int, QString>::detach_helper() (qmap.h:755)
==26346==    by 0x588F32E: SqueezedComboBox::insertSqueezedItem(QString const&, int) (qmap.h:205)
==26346==    by 0x3158F3E4: LutDockerDock::refillComboboxes() (lutdocker_dock.cpp:338)
==26346==    by 0x3158F5D4: LutDockerDock::resetOcioConfiguration() (lutdocker_dock.cpp:305)
==26346==    by 0x3159021A: LutDockerDock::LutDockerDock() (lutdocker_dock.cpp:130)
==26346==    by 0x3158E18F: LutDockerDockFactory::createDockWidget() (lutdocker.cpp:66)
==26346==    by 0x61F037A: KoMainWindow::createDockWidget(KoDockFactoryBase*) (KoMainWindow.cpp:1803)
==26346==    by 0x62240D8: KoView::KoView(KoPart*, KoDocument*, QWidget*) (KoView.cpp:193)
==26346==    by 0x578041B: KisView2::KisView2(KoPart*, KisDoc2*, QWidget*) (kis_view2.cpp:230)
==26346==    by 0x56BC936: KisPart2::createViewInstance(KoDocument*, QWidget*) (kis_part2.cpp:77)
Comment 3 Halla Rempt 2013-12-19 12:08:35 UTC
Git commit 20635fb5459652abacb2b508d982b0e3c98433d8 by Boudewijn Rempt.
Committed on 19/12/2013 at 12:07.
Pushed by rempt into branch 'master'.

M  +11   -4    krita/plugins/extensions/dockers/lut/lutdocker_dock.cpp

Comment 4 Halla Rempt 2013-12-19 12:08:56 UTC
Git commit cc436c574317ad318c9c2070a20a594adaf1c8f8 by Boudewijn Rempt.
Committed on 19/12/2013 at 12:07.
Pushed by rempt into branch 'calligra/2.8'.

M  +11   -4    krita/plugins/extensions/dockers/lut/lutdocker_dock.cpp

Comment 5 Halla Rempt 2013-12-19 12:09:24 UTC
Nope, my fault really. Fix pushed...