Re: [PATCH 05/34] kernelshark: Prevent potential detach of QMap container

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 1/14/24 19:16, Benjamin ROBIN wrote:
Use const_iterator instead. Fix range-loop-detach Clazy warning


Please provide a better explanation of the problem you are trying
to solve with this patch.

Thanks!
Y.

Signed-off-by: Benjamin ROBIN <dev@xxxxxxxxxxxxx>
---
  src/KsGLWidget.cpp             | 5 +++--
  src/plugins/KVMComboDialog.cpp | 6 ++++--
  2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/KsGLWidget.cpp b/src/KsGLWidget.cpp
index 9e3dac3..0a44e77 100644
--- a/src/KsGLWidget.cpp
+++ b/src/KsGLWidget.cpp
@@ -137,9 +137,10 @@ void KsGLWidget::paintGL()
  	/* Draw the time axis. */
  	_drawAxisX(size);
- for (auto const &stream: _graphs)
-		for (auto const &g: stream)
+	for (auto it = _graphs.cbegin(), end = _graphs.cend(); it != end; ++it) {
+		for (auto const &g: it.value())
  			g->draw(size);
+	}
for (auto const &s: _shapes) {
  		if (!s)
diff --git a/src/plugins/KVMComboDialog.cpp b/src/plugins/KVMComboDialog.cpp
index 2b95a53..6be68d4 100644
--- a/src/plugins/KVMComboDialog.cpp
+++ b/src/plugins/KVMComboDialog.cpp
@@ -308,13 +308,15 @@ void KsComboPlotDialog::_applyPress()
  	int nPlots(0);
_plotMap[guestId] = _streamCombos(guestId);
-	for (auto const &stream: _plotMap)
-		for (auto const &combo: stream) {
+
+	for (auto it = _plotMap.cbegin(), end = _plotMap.cend(); it != end; ++it) {
+			for (auto const &combo: it.value()) {
  			allCombosVec.append(2);
  			combo[0] >> allCombosVec;
  			combo[1] >> allCombosVec;
  			++nPlots;
  		}
+	}
emit apply(nPlots, allCombosVec);
  }




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux