Bug 340414 - Krita crashes when using the Grid brush engine....
Summary: Krita crashes when using the Grid brush engine....
Alias: None
Product: krita
Classification: Applications
Component: Brush engines (show other bugs)
Version: git master (please specify the git hash!)
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
Depends on:
Reported: 2014-10-27 23:15 UTC by Ragnar Brynjúlsson
Modified: 2014-11-04 09:52 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:

Scriptis I use for buildilng krita. (669.10 KB, application/gzip)
2014-11-02 18:56 UTC, Ragnar Brynjúlsson
My krita build scripts (669.10 KB, application/gzip)
2014-11-02 19:02 UTC, Ragnar Brynjúlsson

Note You need to log in before you can comment on or make changes to this bug.
Description Ragnar Brynjúlsson 2014-10-27 23:15:58 UTC
Krita crashes when you touch the canvas with a Grid brush, such as Grid_square_25. I've tested it with the Line Pixel Art brush from Cazu's brush collection too.

I'm pretty sure the Grid brush was working correctly less than 10 days ago.

Reproducible: Always

Steps to Reproduce:
1. Select Grid_square_25 brush.
2. Paint with it.
3. Krita crashes.

Actual Results:  
Krita crashes.

Expected Results:  
Get some nice dots on my canvas.

Tested on Ubuntu 14.04, compiled from source commit ba6282042361c9fd219e8a4adf533b7a4c4e1166 today.

Output from terminal:

krita(18265)/koffice (lib komain) KoRuler::createGuideToolConnection: No guides tool found, skipping connection 
krita(18265)/koffice (lib komain) KoRuler::createGuideToolConnection: No guides tool found, skipping connection 
connect failed: No such file or directory
QLayout: Attempting to add QLayout "" to ColorSliderDock "ColorSlider", which already has a layout
krita(18265)/kdeui (kdelibs): No such XML file "/home/ragnar/.krita-unstable/share/apps/" 
QLayout: Attempting to add QLayout "" to QWidget "", which already has a layout
QLayout: Attempting to add QLayout "" to QWidget "", which already has a layout
QLayout: Attempting to add QLayout "" to QWidget "", which already has a layout
QLayout: Attempting to add QLayout "" to QWidget "", which already has a layout
krita: Fatal IO error 9 (Bad file descriptor) on X server :0.
CRITICAL: According to statistics of the KisTileDataStore some tiles have leaked from the Krita control! 
CRITICAL: Tiles in memory: 556 Total tiles: 556 
QFile::at: Cannot set file position 0 
KCrash: Application 'krita' crashing...
KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
Fatal Error: Accessed global static 'KoResourceServerProvider *s_instance()' after destruction. Defined at /home/ragnar/Software/krita/src/calligra/libs/widgets/KoResourceServerProvider.cpp:223
Unable to start Dr. Konqi
Not forwarding the crash to Apport.
Comment 1 Sven Langkamp 2014-10-27 23:50:18 UTC
Works here with current git master. Maybe a clean build helps.
Comment 2 Halla Rempt 2014-10-28 07:07:46 UTC
It could be that


also fixed it, so check that your checkout is up to date.
Comment 3 Ragnar Brynjúlsson 2014-10-28 22:38:09 UTC
I tried deleting the build folder and install folder, updating from git, delete my .kde folder, and rebuilt, and got the same result. It seems to happen with Grid, Spray and Clone brush engines. But since you're able to get it working correctly, it seems to be something with my setup. I'm running cmake like so:


I'll do some further testing, and see if I can figure this out.
Comment 4 Ragnar Brynjúlsson 2014-11-01 22:55:53 UTC
I did some further testing, and have narrowed it down to commit 9e12ec0, the commit before (i.e. 8544535) works fine. The 9e12ec0 commit is the merge from krita-mohit-testing, so probably contains quite a lot of changes.

This time around I compiled them on a more or less clean install of Ubuntu 14.04 64-bit, with only Gimp, MyPaint, InkScape and emacs-nox installed from the repositories, and Spotify from  outside, as well as Nvidia binary drivers.

In addition I had installed the following packages to get Krita to compile and run.

#sudo apt-get build-dep calligra
#sudo apt-get install libeigen3-dev libxi-dev phonon-backend-gstreamer kdelibs5-dev libboost-dev exiv2 git libboost1.54-dev
#sudo apt-get install kde-style-oxygen

Is this an Ubuntu specific thing? What distro are the developers running?
Comment 5 Halla Rempt 2014-11-02 10:30:00 UTC
I currently use OpenSUSE on my laptop and Kubuntu on my desktop. Current git master works for me on both after commit 0006aa0b2be423ab2c512574aa42df70c55dfa25 at least.
Comment 6 Ragnar Brynjúlsson 2014-11-02 18:56:44 UTC
Created attachment 89406 [details]
Scriptis I use for buildilng krita.
Comment 7 Ragnar Brynjúlsson 2014-11-02 19:02:41 UTC
Created attachment 89407 [details]
My krita build scripts
Comment 8 Ragnar Brynjúlsson 2014-11-02 19:06:41 UTC
Sorry about the double post.

I put the build scripts in a folder, and put the Krita source in src/calligra and Vc source in src/Vc-0.7.4, relative to that. Then run ./build-prep, ./build-vc, ./build-krita (choose unstable) and ./build-deb. This builds deb pacakges in deb/krita-unstable. For OpenSUSE and Fedora, I just commented out the dpkg-deb line in build-deb, and copied the resulting sw and usr folders to /. 

This let's me install Krita that is not in path, and just uses a launcher that looks like this.

export KDEDIRS=/sw/krita-unstable:$KDEDIRS
export PATH=/sw/krita-unstable/bin:$PATH
export KDEHOME=~/.krita-unstable
export LD_LIBRARY_PATH=/sw/krita-unstable/lib:$LD_LIBRARY_PATH
mkdir -p ~/.krita-unstable

I works fine for all earlier versions of Krita, but maybe I should give it a shot at building it by hand.
Comment 9 Ragnar Brynjúlsson 2014-11-03 14:31:48 UTC
Tested building it manually, just following the instructions here https://community.kde.org/Calligra/Building#Debian-based_Distributions , and got the same result.

I did discover something interesting though. If I pick a brush that works, such as the Basic_tip_default, and go into Edit brush settings, and change the brush engine to Grid or Clone, I actually get a working Grid or Clone brush. It's only when I've selected a Grid or Clone brush from the presets, that it crashes.

Saving out my new working brush to the brush presets didn't work though. It saved fine, but using it after selecting it from the Brush Presets would crash Krita.
Comment 10 Halla Rempt 2014-11-03 14:33:36 UTC
Ah! And that I can reproduce:

ASSERT: "d" in file /home/boud/kde/src/calligra/krita/image/kis_shared_ptr.h, line 181

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffc48e4700 (LWP 28511)]
0x00007ffff75d8d27 in __GI_raise (sig=sig@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff75d8d27 in __GI_raise (sig=sig@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff75da418 in __GI_abort () at abort.c:89
#2  0x00007ffff53e4c22 in qt_message_output(QtMsgType, char const*) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007ffff53e4f89 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007ffff53e5794 in qFatal(char const*, ...) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#5  0x00007fffd6bdf7f8 in operator-> (this=0x7fffc48e3790)
    at /home/boud/kde/src/calligra/krita/image/kis_shared_ptr.h:181
#6  KisGridPaintOp::paintAt (this=0x7fffa40181a0, info=...)
    at /home/boud/kde/src/calligra/krita/plugins/paintops/gridbrush/kis_grid_paintop.cpp:116
#7  0x00007ffff411a43f in paintAt<KisPaintOp> (distanceInfo=0x1c75790, op=...,
    at /home/boud/kde/src/calligra/krita/image/brushengine/kis_paint_information.h:102
#8  KisPaintOp::paintAt (this=0x7fffa40181a0, info=..., currentDistance=0x1c75790)
    at /home/boud/kde/src/calligra/krita/image/brushengine/kis_paintop.cc:179
#9  0x00007ffff71964b1 in FreehandStrokeStrategy::doStrokeCallback (this=<optimized out>,
    data=<optimized out>)
    at /home/boud/kde/src/calligra/krita/ui/tool/strokes/freehand_stroke.cpp:66
#10 0x00007ffff40cd1b1 in run (this=<optimized out>)
    at /home/boud/kde/build/calligra/krita/image/../../../../src/calligra/krita/image/kis_stroke_job.h:40
#11 KisUpdateJobItem::run (this=0x1825280)
    at /home/boud/kde/build/calligra/krita/image/../../../../src/calligra/krita/image/kis_update_job_item.h:61
#12 0x00007ffff53e2e04 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#13 0x00007ffff53ef39f in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#14 0x00007fffef6eb0a5 in start_thread (arg=0x7fffc48e4700) at pthread_create.c:309
#15 0x00007ffff769c84d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
Comment 11 Halla Rempt 2014-11-03 14:43:20 UTC
Git commit d2a88252bd2d2a3d372a916e817413d935517f47 by Boudewijn Rempt.
Committed on 03/11/2014 at 14:42.
Pushed by rempt into branch 'master'.

Don't crash the grid brush if no current node is set

This is a stop-gap: the real issue is figuring out why we don't set
the node on the preset's settings when selecting it anymore. However,
it never hurts to be careful with pointers.

M  +8    -3    krita/plugins/paintops/gridbrush/kis_grid_paintop.cpp

Comment 12 Ragnar Brynjúlsson 2014-11-03 15:28:53 UTC
Thanks. I recompiled with the fix, and the Grid brush works fine. Though, the same bug still affects the Spray and Clone brush engines.
Comment 13 Halla Rempt 2014-11-03 15:35:11 UTC
Yes... That'll need the same kind of patch, but of course we should fix the root cause in the first place.
Comment 14 Halla Rempt 2014-11-04 09:52:04 UTC
Git commit 90725e068efb32329d3b73b3f1f0492c7fce15db by Boudewijn Rempt.
Committed on 04/11/2014 at 09:51.
Pushed by rempt into branch 'master'.

We need to set the actual current node of the active image, not the
node selected for the previous preset.


M  +2    -2    krita/ui/kis_paintop_box.cc