Bug 423353 - Crash with 4.3.0 appimage when Colour Selector used if a non-existent palette is on the palette docker
Summary: Crash with 4.3.0 appimage when Colour Selector used if a non-existent palette...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Resource Management (other bugs)
Version First Reported In: 4.3.0
Platform: Debian stable Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-22 10:38 UTC by Ahab Greybeard
Modified: 2020-07-28 13:15 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahab Greybeard 2020-06-22 10:38:44 UTC
SUMMARY
This does not happen with the 4.2.9 appimage (but see Additional Information).
It happens with the 4.3.0 and future appimages.
I haven't tested with Windows packages.
It happens with the Colour Selector tool, not the Ctrl picker.

The situation would probably be rare because it involves a particular manipulation of the palette docker so that it displays a just deleted palette or a 'null' palette.
This situation can be created with 4.2.9 but does not lead to a crash with 4.2.9. (but see Additional Information for a 4.2.9 crash.)

When a non-existent or 'null' palette is on the Palette docker, use of the Colour Selector tool with 'Add to Palette' ticked, even if the selected palette is an existing and editable palette, results in a crash.
There is no resulting output in a terminal window and the only log entry is "KRITA DID NOT CLOSE CORRECTLY".

STEPS TO REPRODUCE
First create a situation where there is a non-existent or 'null' palette on the Palette docker:

1. Create a new palette called New Palette (or whatever).
2. Click the Choose Palette button and type in the search box so that only the new palette is shown i.e an exclusive search result.
3. Select the new palette and delete it then click on the workspace to remove the palette docker chooser subwindow.
[NOTE: that the New Palette is still shown on the Palette docker]

See Additional Information for a different/additional crash.

[NOTE: At this stage, Quit then restart will result in a 'null' palette being displayed in the Palette docker.]

4. With the non-existent New Palette (or the 'null' palette) on the Palette docker, use the Colour Picker tool to add a colour to an existing editable palette.
[NOTE: There is a crash]


OBSERVED RESULT
See above and see Additional Information.

In the case of a non-exclusive search result for the palettes, deleting the current palette will give another palette in the palette docker and so no further problem.

EXPECTED RESULT
No crash. There should be some palette selected for the palette docker to display.

SOFTWARE/OS VERSIONS
Krita

 Version: 4.3.0
 Languages: en_GB, en, en, en_GB, en
 Hidpi: false

Qt

  Version (compiled): 5.12.8
  Version (loaded): 5.12.8

OS Information

  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 4.19.0-9-amd64
  Pretty Productname: Debian GNU/Linux 10 (buster)
  Product Type: debian
  Product Version: 10
  Desktop: MATE

OpenGL Info
 
  Vendor:  "NVIDIA Corporation" 
  Renderer:  "GeForce GTX 750 Ti/PCIe/SSE2" 
  Version:  "4.6.0 NVIDIA 440.82" 
  Shading language:  "4.60 NVIDIA" 
  Requested format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
  Current format:    QSurfaceFormat(version 4.6, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
     Version: 4.6
     Supports deprecated functions true 
     is OpenGL ES: false 

QPA OpenGL Detection Info 
  supportsDesktopGL: true 
  supportsOpenGLES: true 
  isQtPreferOpenGLES: false 


ADDITIONAL INFORMATION
With the non-existent New Palette on the Palette docker, clicking on the palette to add a colour will crash 4.2.9 and 4.3.0
Comment 1 Halla Rempt 2020-07-28 12:33:20 UTC
Backtrace:


[KCrash Handler]
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007f78bcc298b1 in __GI_abort () at abort.c:79
#6  0x00007f78bd65468b in qt_message_fatal (context=..., message=<synthetic pointer>...) at global/qlogging.cpp:1914
#7  QMessageLogger::fatal (this=this@entry=0x7ffd6f6d82c0, msg=msg@entry=0x7f78bd9549c8 "ASSERT failure in %s: \"%s\", file %s, line %d") at global/qlogging.cpp:893
#8  0x00007f78bd653edb in qt_assert_x (where=where@entry=0x7f78767fc0d8 "QList<T>::at", what=what@entry=0x7f78767fc0c5 "index out of range", file=file@entry=0x7f78767fbee8 "/usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h", line=line@entry=571) at global/qglobal.cpp:3350
#9  0x00007f7876797796 in QList<QSharedPointer<KoColorSet> >::at (i=<optimized out>, this=0x55ecc97be610) at /home/boud/dev/model-rewrite/libs/pigment/resources/KisSwatch.h:29
#10 KisToolColorPicker::endPrimaryAction (this=0x55ecc97be580, event=<optimized out>) at /home/boud/dev/model-rewrite/plugins/tools/basictools/kis_tool_colorpicker.cc:202
#11 0x00007f78c0d2cb24 in KisToolProxy::forwardToTool (this=<optimized out>, state=KisToolProxy::END, action=KisTool::Primary, event=0x7ffd6f6d8e90, docPoint=...) at /home/boud/dev/model-rewrite/libs/ui/canvas/kis_tool_proxy.cpp:203
#12 0x00007f78c0d2cc8b in KisToolProxy::forwardEvent (this=0x55ecc6524da0, state=state@entry=KisToolProxy::END, action=action@entry=KisTool::Primary, event=event@entry=0x7ffd6f6d8e90, originalEvent=originalEvent@entry=0x7ffd6f6d8e90) at /home/boud/dev/model-rewrite/libs/ui/canvas/kis_tool_proxy.cpp:133
#13 0x00007f78c10d1c89 in KisToolInvocationAction::end (this=0x55ecc0c3dc80, event=0x7ffd6f6d8e90) at /usr/include/c++/9/bits/atomic_base.h:413
#14 0x00007f78c10df8e7 in KisShortcutMatcher::tryEndRunningShortcut (this=this@entry=0x55ecbf849b60, button=<optimized out>, event=event@entry=0x7ffd6f6d8e90) at /home/boud/dev/model-rewrite/libs/ui/input/kis_shortcut_matcher.cpp:683
#15 0x00007f78c10e02ee in KisShortcutMatcher::buttonReleased (this=0x55ecbf849b60, button=<optimized out>, event=event@entry=0x7ffd6f6d8e90) at /home/boud/dev/model-rewrite/libs/ui/input/kis_shortcut_matcher.cpp:300
#16 0x00007f78c10bfb6c in KisInputManager::eventFilterImpl (this=0x55ecc00ff838, event=0x7ffd6f6d8e90) at /usr/include/x86_64-linux-gnu/qt5/QtGui/qevent.h:132
#17 0x00007f78bd86822d in QCoreApplicationPrivate::sendThroughObjectEventFilters (receiver=0x55ecc651b3e0, event=0x7ffd6f6d8e90) at kernel/qcoreapplication.cpp:1201
#18 0x00007f78be757982 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#19 0x00007f78be75f9f8 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#20 0x00007f78c1144539 in KisApplication::notify (this=<optimized out>, receiver=0x55ecc651b3e0, event=0x7ffd6f6d8e90) at /home/boud/dev/model-rewrite/libs/ui/KisApplication.cpp:747
#21 0x00007f78bd8684a8 in QCoreApplication::notifyInternal2 (receiver=0x55ecc651b3e0, event=0x7ffd6f6d8e90) at kernel/qcoreapplication.cpp:1075
#22 0x00007f78be75e07f in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#23 0x00007f78be7b2f81 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#24 0x00007f78be7b5dea in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#25 0x00007f78be7579ac in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#26 0x00007f78be75ebb0 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#27 0x00007f78c1144539 in KisApplication::notify (this=<optimized out>, receiver=0x55ecc0d99120, event=0x7ffd6f6d9390) at /home/boud/dev/model-rewrite/libs/ui/KisApplication.cpp:747
#28 0x00007f78bd8684a8 in QCoreApplication::notifyInternal2 (receiver=0x55ecc0d99120, event=0x7ffd6f6d9390) at kernel/qcoreapplication.cpp:1075
#29 0x00007f78bde658b5 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#30 0x00007f78bde669e5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#31 0x00007f78bde3f1cb in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#32 0x00007f78ad78af9a in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#33 0x00007f78b49b2417 in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#34 0x00007f78b49b2650 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#35 0x00007f78b49b26dc in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#36 0x00007f78bd8c77ac in QEventDispatcherGlib::processEvents (this=0x55ecbd542050, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#37 0x00007f78bd866d2a in QEventLoop::exec (this=this@entry=0x7ffd6f6d9730, flags=..., flags@entry=...) at kernel/qeventloop.cpp:225
#38 0x00007f78bd8704a0 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1383
#39 0x000055ecba79d265 in main (argc=<optimized out>, argv=0x7ffd6f6d9a48) at /home/boud/dev/model-rewrite/krita/main.cc:614
[Inferior 1 (process 24826) detached]
Comment 2 Halla Rempt 2020-07-28 13:15:22 UTC
Git commit abc492c64c345152cc0eade405b28284c4ff04c3 by Boudewijn Rempt.
Committed on 28/07/2020 at 13:14.
Pushed by rempt into branch 'rempt/resourcemodel_rewrite'.

Check whether the palette is valid before adding a color

M  +10   -12   libs/resources/KoResourceServer.h
M  +0    -1    libs/ui/KisPaletteEditor.cpp
M  +21   -26   plugins/tools/basictools/kis_tool_colorpicker.cc
M  +5    -6    plugins/tools/basictools/kis_tool_colorpicker.h

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