Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Commit

Permalink
fix(kdecoration): prevent crash when changing color scheme
Browse files Browse the repository at this point in the history
Capture this by value, check painter for nullness.
  • Loading branch information
gikari committed Apr 1, 2022
1 parent fc925f4 commit 3e872ee
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/kdecoration/decoration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ void Decoration::init()

void Decoration::paint(QPainter *painter, const QRect &repaintRegion)
{
if (!painter) {
return;
}

paintBorders(*painter);
}

Expand Down Expand Up @@ -78,12 +82,12 @@ void Decoration::connectEvents()
auto settingsPtr = settings().data();

// No idea why regular connection does not work
connect(clientPtr, &KDecoration2::DecoratedClient::activeChanged, this, [&](bool value) {
connect(clientPtr, &KDecoration2::DecoratedClient::activeChanged, this, [this](bool value) {
this->update();
});
connect(settingsPtr, &KDecoration2::DecorationSettings::borderSizeChanged, this, &Decoration::setBorderSizes);

connect(m_kdeglobalsWatcher.data(), &KConfigWatcher::configChanged, [&](const KConfigGroup &group, const QByteArrayList &names) {
connect(m_kdeglobalsWatcher.data(), &KConfigWatcher::configChanged, [this](const KConfigGroup &group, const QByteArrayList &names) {
if (group.name() == QStringLiteral("General")) {
if (names.contains(QByteArrayLiteral("ColorScheme")) || names.contains(QByteArrayLiteral("AccentColor"))) {
updateColors();
Expand Down

0 comments on commit 3e872ee

Please sign in to comment.