File 0004-Fixes-crash-in-KLauncher-idleTimeout-caused-by-unblo.patch of Package mingw32-kinit

From 0910cf179eb594eeeffd0f75255ee8cbf5d1f42e Mon Sep 17 00:00:00 2001
From: Ralf Habacker <ralf.habacker@freenet.de>
Date: Wed, 14 Jul 2021 13:18:45 +0200
Subject: [PATCH 04/18] Fixes crash in KLauncher::idleTimeout() caused by
 unblockable destruction of IdleSlave objects

According to the documentation of QObject::destroyed() at
https://doc.qt.io/qt-5/qobject.html#destroyed this signal cannot be
be blocked.
This can lead to the fact that by removing an object from mSlaveList by
slotSlaveGone(), the contents of the list are changed in such a way that
with the next iteration again an access to the deleted object takes place
and thereby a segmentation fault is released.

See the following real world trace without this patch

"2021/07/14 12:57:55,782" idleTimeout
"2021/07/14 12:57:55,782" idleTimeout 0x4d29a60
"2021/07/14 12:57:55,782" idleTimeout 0x4d32778
"2021/07/14 12:57:55,782" idleTimeout killing KIO::IdleSlave(0x4d32778)
"2021/07/14 12:57:55,782" slotSlaveGone QObject(0x4d32778)
"2021/07/14 12:57:55,782" idleTimeout 0x4d54550
"2021/07/14 12:57:55,782" idleTimeout killing KIO::IdleSlave(0x4d54550)
"2021/07/14 12:57:55,782" slotSlaveGone QObject(0x4d54550)
"2021/07/14 12:57:55,782" idleTimeout 0x4d61460
"2021/07/14 12:57:55,782" idleTimeout killing KIO::IdleSlave(0x4d61460)
"2021/07/14 12:57:55,782" slotSlaveGone QObject(0x4d61460)
"2021/07/14 12:57:55,782" idleTimeout 0x4d61460
Thread 1 received signal SIGSEGV, Segmentation fault.

where the calls to slotSlaveGone() are intermixed with the iteration.

In the opposite after applying this patch there is

"2021/07/14 13:06:12,870" idleTimeout
"2021/07/14 13:06:12,870" idleTimeout 0x4d3a668
"2021/07/14 13:06:12,870" idleTimeout 0x4d6f8e8
"2021/07/14 13:06:12,870" idleTimeout killing KIO::IdleSlave(0x4d6f8e8)
"2021/07/14 13:06:12,870" idleTimeout 0x4d60540
"2021/07/14 13:06:12,870" idleTimeout killing KIO::IdleSlave(0x4d60540)
"2021/07/14 13:06:12,870" idleTimeout 0x4d6d400
"2021/07/14 13:06:12,870" idleTimeout killing KIO::IdleSlave(0x4d6d400)
"2021/07/14 13:06:12,870" idleTimeout 0x4da14a8
"2021/07/14 13:06:12,870" idleTimeout killing KIO::IdleSlave(0x4da14a8)
"2021/07/14 13:06:12,870" slotSlaveGone QObject(0x4d6f8e8)
"2021/07/14 13:06:12,870" slotSlaveGone QObject(0x4d60540)
"2021/07/14 13:06:12,870" slotSlaveGone QObject(0x4d6d400)
"2021/07/14 13:06:12,870" slotSlaveGone QObject(0x4da14a8)

which shows that deleting the slaves after leaving idleTimeout() happens.

BUG:426387
FIXED-IN:5.85.0
---
 src/klauncher/klauncher.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/klauncher/klauncher.cpp b/src/klauncher/klauncher.cpp
index 97b8780..44aa76e 100644
--- a/src/klauncher/klauncher.cpp
+++ b/src/klauncher/klauncher.cpp
@@ -1131,7 +1131,7 @@ KLauncher::idleTimeout()
             keepOneFileSlave = false;
         } else if (slave->age(now) > SLAVE_MAX_IDLE) {
             // killing idle slave
-            delete slave;
+            slave->deleteLater();
         }
     }
 }
-- 
2.26.2

openSUSE Build Service is sponsored by