Initialize default KoColor explicitly
This fixes a compile warning about m_colorSpace
not being initialized.
It looks a bit icky, but it's not that bad, and at least avoids
default-initializing the color space.
E.g.:
In file included from krita/libs/pigment/KoColorDisplayRendererInterface.h:14,
from krita/libs/widgets/KoColorSlider.h:12,
from krita/libs/widgets/KoColorSlider.cpp:7:
In member function ‘const KoColorSpace* KoColor::colorSpace() const’,
inlined from ‘virtual void KoColorSlider::drawContents(QPainter*)’ at krita/libs/widgets/KoColorSlider.cpp:82:45:
krita/libs/pigment/KoColor.h:78:16: warning: ‘c.KoColor::m_colorSpace’ may be used uninitialized [-Wmaybe-uninitialized]
78 | return m_colorSpace;
| ^~~~~~~~~~~~
krita/libs/widgets/KoColorSlider.cpp: In member function ‘virtual void KoColorSlider::drawContents(QPainter*)’:
krita/libs/widgets/KoColorSlider.cpp:75:17: note: ‘c’ declared here
75 | KoColor c = d->minColor; // smart way to fetch colorspace
| ^
The point is mostly to get rid of false-positives, so real problems are easier to spot.
Test Plan
Make sure it doesn't crash when loading an image.
Formalities Checklist
-
I confirmed this builds. -
I confirmed Krita ran and the relevant functions work. -
I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!) -
I made sure my commits build individually and have good descriptions as per KDE guidelines. -
I made sure my code conforms to the standards set in the HACKING file. -
I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.