Bug 447522

Summary: Deleting colorize mask swatch switches to second open canvas and occasionally crashes.
Product: [Applications] krita Reporter: Ralek Kolemios <info>
Component: Tools/ColorizeAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: crash CC: dimula73
Priority: NOR    
Version: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Ralek Kolemios 2021-12-26 04:26:27 UTC
5.1.0-prealpha (b27fb80)

1. Create 2 new canvases
2. On the first, create a new layer and add a colorize mask to it
3. Add a stroke on the mask, which creates a color swatch
4. Delete the color swatch
5. Krita switches my current focused canvas to the second one, and occasionally crashes during that.

I haven't been able to reliably find a way to reproduce the crash, though it has happened twice in my testing so far.
Comment 1 Dmitry Kazakov 2021-12-27 17:12:58 UTC
I can reproduce switching to another canvas view, but cannot reproduce the crash right now. I'll continue looking into it.
Comment 2 Dmitry Kazakov 2021-12-27 17:23:26 UTC
The problem seems to be Windows-specific. I cannot reproduce that on Linux.
Comment 3 Dmitry Kazakov 2021-12-27 19:01:50 UTC
This is the backtrace of the view switching accident. It looks like when we switch the view, the tool option widget doesn't switch the associated view.

Thread 1 (Thread 1544.0x2778):
#0  KisViewManager::setCurrentView (this=0x168d6960, view=view@entry=0x2a56ec90) at C:/dev/env-10/krita/libs/ui/KisViewManager.cpp:399
        first = true
        imageView = {wp = {d = 0x2a0bd900, value = 0x2448dc90}}
#1  0x00007ffa5b0b0b03 in KisMainWindow::setActiveView (this=this@entry=0x14cd6b00, view=view@entry=0x2a56ec90) at C:/dev/env-10/krita/libs/ui/KisMainWindow.cpp:1599
No locals.
#2  0x00007ffa5b0bad78 in KisMainWindow::setActiveSubWindow (this=this@entry=0x14cd6b00, window=<optimized out>) at C:/dev/env-10/krita/libs/ui/KisMainWindow.cpp:2673
        view = 0x2a56ec90
        subwin = 0x387bac30
#3  0x00007ffa5b0bbef1 in KisMainWindow::setActiveSubWindow (window=<optimized out>, this=0x14cd6b00) at C:/dev/env-10/krita/libs/ui/KisMainWindow.cpp:2664
        subwin = <optimized out>
        subwin = <optimized out>
        view = <optimized out>
#4  KisMainWindow::subWindowActivated (this=0x14cd6b00) at C:/dev/env-10/krita/libs/ui/KisMainWindow.cpp:2434
        enabled = <optimized out>
        subWindow = <optimized out>
#5  0x00007ffa5b0c2229 in KisMainWindow::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at libs/ui/kritaui_autogen/include/moc_KisMainWindow.cpp:386
        _t = <optimized out>
#6  0x00007ffa7f9e92b8 in QMetaObject::activate(QObject*, int, int, void**) () from C:\dev\env-10\i\bin\Qt5Core.dll
No symbol table info available.
#7  0x00007ffa7ed63566 in QMdiArea::childEvent(QChildEvent*) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#8  0x00007ffa7ed64235 in QMdiArea::scrollContentsBy(int, int) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#9  0x00007ffa7ed65028 in QMdiArea::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#10 0x00007ffa7f9e92b8 in QMetaObject::activate(QObject*, int, int, void**) () from C:\dev\env-10\i\bin\Qt5Core.dll
No symbol table info available.
#11 0x00007ffa7ed6fab0 in QMdiSubWindow::qt_metacast(char const*) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#12 0x00007ffa7ed6fd47 in QMdiSubWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#13 0x00007ffa7f9e92b8 in QMetaObject::activate(QObject*, int, int, void**) () from C:\dev\env-10\i\bin\Qt5Core.dll
No symbol table info available.
#14 0x00007ffa7ec2c71f in QApplicationPrivate::setFocusWidget(QWidget*, Qt::FocusReason) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#15 0x00007ffa7ec5fd9c in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#16 0x00007ffa7ec609f1 in QWidget::focusNextPrevChild(bool) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#17 0x00007ffa7ec608e7 in QWidget::focusNextPrevChild(bool) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#18 0x00007ffa7ec608e7 in QWidget::focusNextPrevChild(bool) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#19 0x00007ffa7ed8d771 in QScrollArea::focusNextPrevChild(bool) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#20 0x00007ffa7ec608e7 in QWidget::focusNextPrevChild(bool) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#21 0x00007ffa7ec608e7 in QWidget::focusNextPrevChild(bool) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#22 0x00007ffa7ec608e7 in QWidget::focusNextPrevChild(bool) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#23 0x00007ffa7ec608e7 in QWidget::focusNextPrevChild(bool) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#24 0x00007ffa7ec608e7 in QWidget::focusNextPrevChild(bool) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#25 0x00007ffa7ec605d3 in QWidgetPrivate::setEnabled_helper(bool) () from C:\dev\env-10\i\bin\Qt5Widgets.dll
No symbol table info available.
#26 0x00007ffa20f66e58 in KisToolLazyBrushOptionsWidget::slotCurrentFgColorChanged (this=0x2a57e410, color=...) at C:/dev/env-10/krita/plugins/tools/tool_lazybrush/kis_tool_lazy_brush_options_widget.cpp:208
        found = false
        candidateIdx = {r = 2140663360, c = 0, i = 1076867512, m = 0x2a57fc90}
        newIndex = {r = 347382352, c = 0, i = 18446462598732840960, m = 0x0}
#27 0x00007ffa20f69196 in KisToolLazyBrushOptionsWidget::slotColorLabelsChanged (this=0x2a57e410) at C:/dev/env-10/krita/plugins/tools/tool_lazybrush/kis_tool_lazy_brush_options_widget.cpp:242
No locals.
#28 0x00007ffa20f618a5 in KisToolLazyBrushOptionsWidget::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at plugins/tools/tool_lazybrush/kritatoollazybrush_autogen/EWIEGA46WW/moc_kis_tool_lazy_brush_options_widget.cpp:138
        _t = <optimized out>
#29 0x00007ffa7f9ea05a in QObject::event(QEvent*) () from C:\dev\env-10\i\bin\Qt5Core.dll
No symbol table info available.
Comment 4 Dmitry Kazakov 2022-01-04 14:05:33 UTC
Git commit 3d92e484a07175f19c7c8b37b6eb520950b38285 by Dmitry Kazakov.
Committed on 04/01/2022 at 14:05.
Pushed by dkazakov into branch 'master'.

Fix weird tool options switching views spradically

The hidden tool options should not be a part of the main widget
hierarchy, otherwise they may activate a different canvas accidentially
on the enableness switch of a sibling.

M  +7    -1    libs/widgets/KoToolDocker.cpp

https://invent.kde.org/graphics/krita/commit/3d92e484a07175f19c7c8b37b6eb520950b38285
Comment 5 Dmitry Kazakov 2022-01-04 14:06:52 UTC
Git commit d02f824dc1b93fcdc02f5873485f1b4410069242 by Dmitry Kazakov.
Committed on 04/01/2022 at 14:06.
Pushed by dkazakov into branch 'krita/5.0'.

Fix weird tool options switching views spradically

The hidden tool options should not be a part of the main widget
hierarchy, otherwise they may activate a different canvas accidentially
on the enableness switch of a sibling.
(cherry picked from commit 3d92e484a07175f19c7c8b37b6eb520950b38285)

M  +7    -1    libs/widgets/KoToolDocker.cpp

https://invent.kde.org/graphics/krita/commit/d02f824dc1b93fcdc02f5873485f1b4410069242
Comment 6 Dmitry Kazakov 2022-01-04 14:07:14 UTC
Git commit aa68b567d26abc605eff95705d82c538e8ceafda by Dmitry Kazakov.
Committed on 04/01/2022 at 14:07.
Pushed by dkazakov into branch 'krita/5.0.0'.

Fix weird tool options switching views spradically

The hidden tool options should not be a part of the main widget
hierarchy, otherwise they may activate a different canvas accidentially
on the enableness switch of a sibling.
(cherry picked from commit 3d92e484a07175f19c7c8b37b6eb520950b38285)

M  +7    -1    libs/widgets/KoToolDocker.cpp

https://invent.kde.org/graphics/krita/commit/aa68b567d26abc605eff95705d82c538e8ceafda