Bug 346860

Summary: Eraser toggle hangs Krita with large brushes
Product: [Applications] krita Reporter: vanyossi <ghevan>
Component: Brush enginesAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: griffinvalley, halla
Priority: NOR    
Version First Reported In: 2.9   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description vanyossi 2015-04-28 18:15:31 UTC
Version 2.9.3 ( git c92560c92e )

On certain brush engines toggling eraser causes Krita to hang for as much as 20 secs. This occurs most common engines like Pixel, Color smudge, Bristle and sketch. Chalk, Shape and grid engine seems to be unafected.

Reproducible: Always

Steps to Reproduce:
1. Select a pixel preset: example. "Airbrush Noisy"
2. Make size the biggest possible.
3. Toggle eraser mode pressing "E", o using the toolbox eraser icon.


Actual Results:  
Krita hangs. Cpu usage goes up to 100% and its impossible to paint while its frozen.

Expected Results:  
No waiting time

chalk brushes super sized, does not hang at all when toggling eraser mode.

Only changing to eraser mode makes Krita hang but changing to other painting modes wont make it hang.

After further testing it seems that using the toolbox "blending mode" menu to change mode from anything to eraser and back, does not cause the hang.
Comment 1 wolthera 2015-04-28 18:18:32 UTC
Confirming this :/

git: a9142e0
Comment 2 Halla Rempt 2015-04-29 09:32:10 UTC
I first thought that this was about the cursor outline, but no -- and it's pretty impressive, because krita uses 100% on _all_ cpu's here! Even multithreaded filters don't manage that.
Comment 3 Halla Rempt 2015-04-29 09:43:42 UTC
From a quick look, it looks like we've got the same problem with that brush if we change the size or anything else: every change sets off a recalculation of the brush mask, those are done in the background, so we get a huge queue of recalcs, and those saturate the cpu's. The solution would be to add a delay timer like we've got in many other places.

0	__lll_lock_wait_private	/lib64/libc.so.6		0x7fffeec4d5db	
1	_L_lock_137	/lib64/libc.so.6		0x7fffeeb9476d	
2	random	/lib64/libc.so.6		0x7fffeeb94661	
3	rand	/lib64/libc.so.6		0x7fffeeb94b79	
4	KisBrushMaskScalarApplicator<KisMaskGenerator, (Vc::Implementation)6>::processScalar	kis_brush_mask_applicators.h	187	0x7ffff6c58bf1	
5	operator()	kis_brush_mask_applicator_base.h	80	0x7ffff6f6686e	
6	QtConcurrent::MapKernel<QRect*, OperatorWrapper>::runIteration	qtconcurrentmapkernel.h	73	0x7ffff6f6686e	
7	whileThreadFunction	qtconcurrentiteratekernel.h	303	0x7ffff6f671aa	
8	QtConcurrent::IterateKernel<QRect*, void>::threadFunction	qtconcurrentiteratekernel.h	227	0x7ffff6f671aa	
9	QtConcurrent::ThreadEngineBase::startBlocking()	/usr/lib64/libQtCore.so.4		0x7fffefe885d5	
10	startBlocking	qtconcurrentthreadengine.h	162	0x7ffff6f6707b	
11	startBlocking	qtconcurrentthreadengine.h	265	0x7ffff6f6707b	
12	QtConcurrent::blockingMap<QVector<QRect>, OperatorWrapper>	qtconcurrentmap.h	197	0x7ffff6f6707b	
13	KisAutoBrush::generateMaskAndApplyMaskOrCreateDab	kis_auto_brush.cpp	266	0x7ffff6f635c2	
14	KisBrush::mask	kis_brush.cpp	446	0x7ffff6f6aee8	
15	KisAutoBrush::createBrushPreview	kis_auto_brush.cpp	303	0x7ffff6f62231	
16	KisAutoBrush::KisAutoBrush	kis_auto_brush.cpp	72	0x7ffff6f62fd2	
17	KisAutoBrushWidget::paramChanged	kis_auto_brush_widget.cpp	164	0x7fffd711810d	
18	KisAutoBrushWidget::spinBoxRandomnessChanged	kis_auto_brush_widget.cpp	240	0x7fffd7119f6c	
19	KisAutoBrushWidget::qt_static_metacall	kis_auto_brush_widget.moc	142	0x7fffd711a201	
20	QMetaObject::activate(QObject*, QMetaObject const*, int, void**)	/usr/lib64/libQtCore.so.4		0x7fffeffac1fa	
21	KisDoubleSliderSpinBox::valueChanged	moc_kis_slider_spin_box.cpp	289	0x7ffff7469730	
22	KisDoubleSliderSpinBox::setValue	kis_slider_spin_box.cpp	826	0x7ffff77a5689	
23	KisAutoBrushWidget::setBrush	kis_auto_brush_widget.cpp	320	0x7fffd71179be	
24	KisBrushSelectionWidget::setCurrentBrush	kis_brush_selection_widget.cpp	179	0x7fffd713b089	
25	KisBrushOptionWidget::readOptionSetting	kis_brush_option_widget.cpp	85	0x7fffd7132231	
26	KisPaintOpOption::startReadOptionSetting	kis_paintop_option.cpp	83	0x7ffff763d315	
27	KisPaintOpOptionsWidget::setConfiguration	kis_paintop_options_widget.cpp	111	0x7ffff7642520	
28	KisPaintopBox::slotOpacityChanged	kis_paintop_box.cc	953	0x7ffff762c8f2	
29	KisPaintopBox::qt_static_metacall	moc_kis_paintop_box.cpp	127	0x7ffff746ed79	
30	QMetaObject::activate(QObject*, QMetaObject const*, int, void**)	/usr/lib64/libQtCore.so.4		0x7fffeffac1fa	
31	KisCanvasResourceProvider::sigOpacityChanged	kis_canvas_resource_provider.moc	224	0x7ffff756d803	
32	KisCanvasResourceProvider::slotCanvasResourceChanged	kis_canvas_resource_provider.cpp	344	0x7ffff757420e	
33	KisCanvasResourceProvider::qt_static_metacall	kis_canvas_resource_provider.moc	119	0x7ffff75758cc	
34	QMetaObject::activate(QObject*, QMetaObject const*, int, void**)	/usr/lib64/libQtCore.so.4		0x7fffeffac1fa	
35	KoCanvasResourceManager::canvasResourceChanged	KoCanvasResourceManager.moc	112	0x7ffff3fb1c93	
36	KoCanvasResourceManager::setResource	KoCanvasResourceManager.cpp	56	0x7ffff3fb1cc6	
37	KisCanvasResourceProvider::setOpacity	kis_canvas_resource_provider.cpp	421	0x7ffff756cf85	
38	KisPaintopBox::sliderChanged	kis_paintop_box.cc	888	0x7ffff762c494	
39	KisPaintopBox::slotSlider1Changed	kis_paintop_box.cc	895	0x7ffff762c757	
40	KisPaintopBox::qt_static_metacall	moc_kis_paintop_box.cpp	123	0x7ffff746ed20	
41	QMetaObject::activate(QObject*, QMetaObject const*, int, void**)	/usr/lib64/libQtCore.so.4		0x7fffeffac1fa	
42	KisDoubleSliderSpinBox::valueChanged	moc_kis_slider_spin_box.cpp	289	0x7ffff7469730	
43	KisAbstractSliderSpinBox::mouseMoveEvent	kis_slider_spin_box.cpp	366	0x7ffff77a53c4	
44	QWidget::event(QEvent*)	/usr/lib64/libQtGui.so.4		0x7ffff09f5d35	
45	QApplicationPrivate::notify_helper(QObject*, QEvent*)	/usr/lib64/libQtGui.so.4		0x7ffff09a676c	
46	QApplication::notify(QObject*, QEvent*)	/usr/lib64/libQtGui.so.4		0x7ffff09acdea	
47	KisApplication::notify	KisApplication.cpp	488	0x7ffff7822537	
48	QCoreApplication::notifyInternal(QObject*, QEvent*)	/usr/lib64/libQtCore.so.4		0x7fffeff982ad	
49	QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool)	/usr/lib64/libQtGui.so.4		0x7ffff09ac5e3	
50	??	/usr/lib64/libQtGui.so.4		0x7ffff0a1dc9b	
51	QApplication::x11ProcessEvent(_XEvent*)	/usr/lib64/libQtGui.so.4		0x7ffff0a1c70c	
52	??	/usr/lib64/libQtGui.so.4		0x7ffff0a43f30	
53	QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)	/usr/lib64/libQtCore.so.4		0x7fffeff96e6f	
54	QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)	/usr/lib64/libQtCore.so.4		0x7fffeff97165	
55	QCoreApplication::exec()	/usr/lib64/libQtCore.so.4		0x7fffeff9c5b9	
56	main	main.cc	179	0x402ae2
Comment 4 Halla Rempt 2016-04-16 13:14:18 UTC
Fixed when building with either vc 1.2 or with mingw..