Bug 428256 - Krita crash when resizing small color selector docker
Summary: Krita crash when resizing small color selector docker
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Dockers (other bugs)
Version First Reported In: unspecified
Platform: Kubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: Maksym Gryb
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-26 03:51 UTC by PangolinM
Modified: 2021-01-12 13:35 UTC (History)
4 users (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 PangolinM 2020-10-26 03:51:04 UTC
SUMMARY
In Krita version 4.2.9, after closing all documents to show the screen that shows "Start", "Recent Documents", "Community", et cetera, if you try to change the size of the Small Color Selector docker causes Krita to crash.

STEPS TO REPRODUCE
1. Open at least one document in Krita, or make new one.
2. Close all documents.
3. Attempt to do anything that would change the size of the Small Color Selector docker, such as resizing neighboring dockers or docking it anywhere.

OBSERVED RESULT
Crash to desktop.

EXPECTED RESULT


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 4.2.9
(available in About System)
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8

ADDITIONAL INFORMATION
I'm a new linux user, so I don't know how much use this will be, but here's the backtrace generated by the crash reporting assistant:
https://pastebin.com/FUcTWc4A
Comment 1 Halla Rempt 2020-10-26 09:11:22 UTC
Please update to the latest release of Krita: 4.4.0. Krita 4.2.9 is no longer supported, even though some Linux distributions still package it because they never update packages to a newer version.

You can get an appimage that should run on almost every Linux distribution from https://krita.org/en/download/krita-desktop/ -- just download the appimage, make it executable and run it. See https://www.davidrevoy.com/article322/krita-appimage-for-cats
Comment 2 PangolinM 2020-10-26 18:08:54 UTC
(In reply to Boudewijn Rempt from comment #1)
> Please update to the latest release of Krita: 4.4.0. Krita 4.2.9 is no
> longer supported, even though some Linux distributions still package it
> because they never update packages to a newer version.
> 
> You can get an appimage that should run on almost every Linux distribution
> from https://krita.org/en/download/krita-desktop/ -- just download the
> appimage, make it executable and run it. See
> https://www.davidrevoy.com/article322/krita-appimage-for-cats

The crash still occurs in 4.4.0.
Comment 3 Ahab Greybeard 2020-10-28 16:05:22 UTC
I can Confirm this for the 4.4.0 and Oct27 4.4.1 prealpha (git ec67f1f) appimages.
This is on Debian 10 with a MATE desktop.
It does not happen with the Windows 10 installed 4.4.0 version.

At the start of a session, you can dock a floating Small Colour Selector with no problem.
If you open a new document and then close it, docking a floating Small Colour Selector or dragging docker panels such that they resize it will cause a crash.

The crash does not happen with the Advanced Colour Selector.
Comment 4 David Conner 2020-11-11 21:53:05 UTC
I can also confirm this is still happening in the 5.0.0-prealpha. 

When I trace the error through the debugger, the problem seems a pointer resolving to null in KisSmallColorWidget::generationColorSpace(). It's trying to call `result->colorModelId()`, but it's blowing up.

Sorry if this is too much tech detail. I'm going to continue tracing through the code, but I'm not sure I should assign this to myself just yet.
Comment 5 Maksym Gryb 2020-12-14 06:14:11 UTC
On Windows 10 with Krita 4.4.1, the following sequence has a chance to crash the application:

1. open Krita
2. resize Small Color Selector
3. create new document
4. close document
5. resize Small Color Selector
6. Krita crashes

It crashes about 1 in 3 times, which is a very high rate for me since it pretty much never crashed on me in the last few months of drawing.

I'll look into what David Connor mentioned in November.
Comment 6 Halla Rempt 2020-12-14 09:30:08 UTC
This patch should do the trick, I guess, though the logic there seems iffy to me:

diff --git a/plugins/dockers/smallcolorselector/kis_small_color_widget.cc b/plugins/dockers/smallcolorselector/kis_small_color_widget.cc
index 0a1166cffe..2262adfcc3 100644
--- a/plugins/dockers/smallcolorselector/kis_small_color_widget.cc
+++ b/plugins/dockers/smallcolorselector/kis_small_color_widget.cc
@@ -67,14 +67,15 @@ struct KisSmallColorWidget::Private {
 
         if (!result || result->colorModelId() != RGBAColorModelID) {
             result = outputColorSpace();
-        } else if (result->colorDepthId() != Float32BitsColorDepthID) {
+        }
+        else if (result && result->colorDepthId() != Float32BitsColorDepthID) {
             result = KoColorSpaceRegistry::instance()->
                 colorSpace(RGBAColorModelID.id(), Float32BitsColorDepthID.id(), result->profile());
         }
 
         // PQ color space we deliniearize into linear one
-        if (result->colorModelId() == RGBAColorModelID &&
-            result->profile()->uniqueId() == KoColorSpaceRegistry::instance()->p2020PQProfile()->uniqueId()) {
+        if (result && result->colorModelId() == RGBAColorModelID &&
+                result->profile()->uniqueId() == KoColorSpaceRegistry::instance()->p2020PQProfile()->uniqueId()) {
 
             result = KoColorSpaceRegistry::instance()->
                     colorSpace(RGBAColorModelID.id(), Float32BitsColorDepthID.id(),
lines 1-23/23 (END)
Comment 7 Halla Rempt 2021-01-12 13:34:49 UTC
Git commit 20a79f6d1225c8172c35428d5c33544df6de12c5 by Halla Rempt.
Committed on 12/01/2021 at 13:34.
Pushed by rempt into branch 'master'.

M  +2    -3    plugins/dockers/smallcolorselector/kis_small_color_widget.cc

https://invent.kde.org/graphics/krita/commit/20a79f6d1225c8172c35428d5c33544df6de12c5
Comment 8 Halla Rempt 2021-01-12 13:35:13 UTC
Git commit 1dde6b83db631c30f9f65168289732b2186ad7bb by Halla Rempt.
Committed on 12/01/2021 at 13:35.
Pushed by rempt into branch 'krita/4.3'.

(cherry picked from commit 20a79f6d1225c8172c35428d5c33544df6de12c5)

M  +2    -3    plugins/dockers/smallcolorselector/kis_small_color_widget.cc

https://invent.kde.org/graphics/krita/commit/1dde6b83db631c30f9f65168289732b2186ad7bb