From 75e042173d41cac9d364644c47962e5b0f8da73e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 21 Mar 2025 21:26:33 +0100 Subject: [PATCH] QFileSystemModel: remove an unneeded const_cast MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QAIM::createIndex() takes a const void* pointer, so we don't need to const_cast the const away. Amends the start of the public history. Picking all the way back, because I'm hunting a memleak here, and can't say, yet, whether these lines need to be modified or not. Besides, this change is 100% safe: either it compiles and works as before or it doesn't compile. There is no silent breakage possible. Pick-to: 6.8 6.5 5.15 Change-Id: I2f9284540beed9d1ab027ac1e24f1c527537e122 Reviewed-by: Robert Löhning Reviewed-by: Volker Hilsheimer Reviewed-by: Thiago Macieira (cherry picked from commit 9f2db4acd7d063b884cf3ad4f085f1644ba925db) Reviewed-by: Daniel Smith --- src/gui/itemmodels/qfilesystemmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/itemmodels/qfilesystemmodel.cpp b/src/gui/itemmodels/qfilesystemmodel.cpp index 42d83775b8a..d950fd193a0 100644 --- a/src/gui/itemmodels/qfilesystemmodel.cpp +++ b/src/gui/itemmodels/qfilesystemmodel.cpp @@ -233,7 +233,7 @@ QModelIndex QFileSystemModel::index(int row, int column, const QModelIndex &pare const QFileSystemModelPrivate::QFileSystemNode *indexNode = parentNode->children.value(childName); Q_ASSERT(indexNode); - return createIndex(row, column, const_cast(indexNode)); + return createIndex(row, column, indexNode); } /*!