31 lines
1.5 KiB
Diff
31 lines
1.5 KiB
Diff
|
From 7cb5edab11bcf99788451b00994854d175386781 Mon Sep 17 00:00:00 2001
|
||
|
From: Fabian Vogt <fabian@ritter-vogt.de>
|
||
|
Date: Wed, 30 Dec 2020 17:17:25 +0100
|
||
|
Subject: [PATCH 2/2] Don't create dangling iterators in TransferMultiSegKio
|
||
|
|
||
|
m_dataSourceFactory->mirrors() returns a value, which is destroyed after the
|
||
|
assignment, but the iterators still point to it.
|
||
|
---
|
||
|
transfer-plugins/multisegmentkio/transfermultisegkio.cpp | 5 +++--
|
||
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/transfer-plugins/multisegmentkio/transfermultisegkio.cpp b/transfer-plugins/multisegmentkio/transfermultisegkio.cpp
|
||
|
index 5b5d898b..87b74148 100644
|
||
|
--- a/transfer-plugins/multisegmentkio/transfermultisegkio.cpp
|
||
|
+++ b/transfer-plugins/multisegmentkio/transfermultisegkio.cpp
|
||
|
@@ -182,8 +182,9 @@ void TransferMultiSegKio::slotDataSourceFactoryChange(Transfer::ChangesFlags cha
|
||
|
}
|
||
|
if (change & Tc_Source) {
|
||
|
m_source = QUrl();
|
||
|
- QHash< QUrl, QPair<bool, int> >::const_iterator it = m_dataSourceFactory->mirrors().constBegin();
|
||
|
- QHash< QUrl, QPair<bool, int> >::const_iterator end = m_dataSourceFactory->mirrors().constEnd();
|
||
|
+ QHash< QUrl, QPair<bool, int> > mirrors = m_dataSourceFactory->mirrors();
|
||
|
+ QHash< QUrl, QPair<bool, int> >::const_iterator it = mirrors.constBegin();
|
||
|
+ QHash< QUrl, QPair<bool, int> >::const_iterator end = mirrors.constEnd();
|
||
|
for (; it != end; it++) {
|
||
|
if (it.value().first) {
|
||
|
m_source = it.key();
|
||
|
--
|
||
|
2.25.1
|
||
|
|