File Avoid-potential-disconnect-of-all-signals-in-IconItem.patch of Package plasma-framework

From c215c54eced5bd0b195c208dd72bb580e65f8fe4 Mon Sep 17 00:00:00 2001
From: David Edmundson <kde@davidedmundson.co.uk>
Date: Thu, 14 May 2020 12:19:27 +0100
Subject: Avoid potential disconnect of all signals in IconItem

Summary:
m_svgIcon can be null.

disconnect(q, nullptr, nullptr, nullptr); would have pretty catastrophic
consequences as it disconnects everything. Anyone listening for
QObject::destroyed of IconItem for cleanup would no longer get anything.
That could lead to obscure conditions.

ShaderEffectSource watches for the source being destroyed for cleanup
and we have a newly introduced crash with ShaderEffectSource that seems
to come from this patch.

BUG: 421170

Test Plan:
Someone who could reproduce the crash reliably confirms it fixes the
issue

Reviewers: #plasma

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D29742
---
 src/declarativeimports/core/iconitem.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/declarativeimports/core/iconitem.cpp b/src/declarativeimports/core/iconitem.cpp
index c59fd18..092a6fb 100644
--- a/src/declarativeimports/core/iconitem.cpp
+++ b/src/declarativeimports/core/iconitem.cpp
@@ -196,7 +196,9 @@ public:
     }
 
     ~SvgSource() {
-        QObject::disconnect(m_iconItem, nullptr, m_svgIcon, nullptr);
+        if (m_svgIcon) {
+            QObject::disconnect(m_iconItem, nullptr, m_svgIcon, nullptr);
+        }
     }
 
     bool isValid() const override
-- 
cgit v1.1