BUG: 404975 Really hard to choose color in tool options
AbandonedPublic

Authored by scottpetrovic on Apr 12 2019, 9:24 PM.

Details

Summary

This ticket's primary aim is to fix this ticket...

https://bugs.kde.org/show_bug.cgi?id=404975

While trying to fix this, I noticed some of the cause of the "color fighting" was because of the large amount of signals that were being emitted and processed with the stroke and fill widgets for vector controls.

I tried to help limit all these signals with a couple compressors on the fill and stroke config widgets.

After adding those compressors, the state of the widgets were not updating right when changing selection. I then spent some time modifying the logic to get the tool options for the stroke and fill to update correctly.

One thing to point out that I changed was how a "None" fill is calculated. Previously "None" was only calculated if a stroke object didn't exist (see the wrapper.type() ).

I also modified the UI to select "none" type if the border size is set to 0. You cannot select a "0" border width if you have a solid border selected on the UI now. It will only go down to 1px now. The UI seemed to get in an odd state if you made a border 0px, then de-selected the object, then re-select it.

Test Plan

I tried selecting one, none, and multiple shapes with the vector tool options.

I think the options are all updating correctly -- but please let me know if anything is not correct.

Diff Detail

Repository
R37 Krita
Lint
Lint Skipped
Unit
Unit Tests Skipped
scottpetrovic created this revision.Apr 12 2019, 9:24 PM
Restricted Application added a project: Krita. ยท View Herald TranscriptApr 12 2019, 9:24 PM
scottpetrovic requested review of this revision.Apr 12 2019, 9:24 PM
scottpetrovic edited the summary of this revision. (Show Details)Apr 12 2019, 9:29 PM
dkazakov requested changes to this revision.Apr 15 2019, 1:43 PM
dkazakov added a subscriber: dkazakov.

Hi, @scottpetrovic!

The patch seem to fix the original problem, but it introduces a crash (with ASAN enabled). When you switch to gradient fill/stroke and the shape doesn't have gradient yet, it crashes with invalid memory access:

=================================================================
==21233==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6170000a9940 at pc 0x7f459dd4a1d8 bp 0x7fffeb8d10e0 sp 0x7fffeb8d10d0
WRITE of size 4 at 0x6170000a9940 thread T0
    #0 0x7f459dd4a1d7 in KoAbstractGradient::generatePreview(int, int) const /home/devel5/rawenv-1/krita/libs/pigment/resources/KoAbstractGradient.cpp:129
    #1 0x7f45a72f09c0 in KisStopGradientSliderWidget::paintEvent(QPaintEvent*) /home/devel5/rawenv-1/krita/libs/ui/widgets/kis_stopgradient_slider_widget.cpp:120
    #2 0x7f45a2309207 in QWidget::event(QEvent*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x1a2207)
    #3 0x7f45a22c89db in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x1619db)
    #4 0x7f45a22d015f in QApplication::notify(QObject*, QEvent*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x16915f)
    #5 0x7f45a745d7da in KisApplication::notify(QObject*, QEvent*) /home/devel5/rawenv-1/krita/libs/ui/KisApplication.cpp:639
    #6 0x7f45a182ac37 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Core.so.5+0x285c37)
    #7 0x7f45a2301bf4 in QWidgetPrivate::sendPaintEvent(QRegion const&) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19abf4)
    #8 0x7f45a23022e1 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19b2e1)
    #9 0x7f45a23030bb in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19c0bb)
    #10 0x7f45a2302fa8 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19bfa8)
    #11 0x7f45a2302fa8 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19bfa8)
    #12 0x7f45a2302fa8 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19bfa8)
    #13 0x7f45a2302fa8 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19bfa8)
    #14 0x7f45a2301d95 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19ad95)
    #15 0x7f45a23030bb in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19c0bb)
    #16 0x7f45a2301d95 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19ad95)
    #17 0x7f45a23030bb in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19c0bb)
    #18 0x7f45a2301d95 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19ad95)
    #19 0x7f45a23030bb in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19c0bb)
    #20 0x7f45a2302fa8 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19bfa8)
    #21 0x7f45a2302fa8 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19bfa8)
    #22 0x7f45a2301d95 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19ad95)
    #23 0x7f45a23030bb in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19c0bb)
    #24 0x7f45a2301d95 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19ad95)
    #25 0x7f45a23030bb in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19c0bb)
    #26 0x7f45a2301d95 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19ad95)
    #27 0x7f45a23030bb in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19c0bb)
    #28 0x7f45a2301d95 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19ad95)
    #29 0x7f45a23030bb in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19c0bb)
    #30 0x7f45a2301d95 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19ad95)
    #31 0x7f45a23030bb in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19c0bb)
    #32 0x7f45a2302fa8 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19bfa8)
    #33 0x7f45a2302fa8 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19bfa8)
    #34 0x7f45a2302fa8 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19bfa8)
    #35 0x7f45a2302fa8 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19bfa8)
    #36 0x7f45a2301d95 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x19ad95)
    #37 0x7f45a22d8cca  (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x171cca)
    #38 0x7f45a22d8ea7  (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x171ea7)
    #39 0x7f45a22f0f3e in QWidgetPrivate::syncBackingStore() (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x189f3e)
    #40 0x7f45a2309417 in QWidget::event(QEvent*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x1a2417)
    #41 0x7f45a2414408 in QMainWindow::event(QEvent*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x2ad408)
    #42 0x7f45a2e26a2c in KMainWindow::event(QEvent*) /home/devel5/rawenv-1/krita/libs/widgetutils/xmlgui/kmainwindow.cpp:784
    #43 0x7f45a2ea391a in KXmlGuiWindow::event(QEvent*) /home/devel5/rawenv-1/krita/libs/widgetutils/xmlgui/kxmlguiwindow.cpp:125
    #44 0x7f45a22c89db in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x1619db)
    #45 0x7f45a22d015f in QApplication::notify(QObject*, QEvent*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Widgets.so.5+0x16915f)
    #46 0x7f45a745d7da in KisApplication::notify(QObject*, QEvent*) /home/devel5/rawenv-1/krita/libs/ui/KisApplication.cpp:639
    #47 0x7f45a182ac37 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Core.so.5+0x285c37)
    #48 0x7f45a182d859 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Core.so.5+0x288859)
    #49 0x7f45a18859c2  (/home/devel5/rawenv-1/deps/usr/lib/libQt5Core.so.5+0x2e09c2)
    #50 0x7f4599e85196 in g_main_context_dispatch (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4a196)
    #51 0x7f4599e853ef  (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4a3ef)
    #52 0x7f4599e8549b in g_main_context_iteration (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4a49b)
    #53 0x7f45a1884fae in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Core.so.5+0x2dffae)
    #54 0x7f45a1828fc9 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (/home/devel5/rawenv-1/deps/usr/lib/libQt5Core.so.5+0x283fc9)
    #55 0x7f45a18320e3 in QCoreApplication::exec() (/home/devel5/rawenv-1/deps/usr/lib/libQt5Core.so.5+0x28d0e3)
    #56 0x40951a in main /home/devel5/rawenv-1/krita/krita/main.cc:495
    #57 0x7f45a0c6382f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #58 0x40b3e8 in _start (/home/devel5/rawenv-1/krita-inst/bin/krita+0x40b3e8)
This revision now requires changes to proceed.Apr 15 2019, 1:43 PM
scottpetrovic abandoned this revision.Apr 20 2019, 1:32 PM

I just moved this ticket to gitlab
https://invent.kde.org/kde/krita/merge_requests/10

I am going to close this ticket and we can continue it there.