<div dir="ltr">hi,<br><br>running plasma-systemmonitor with valgring a lot of problems are declared,<br>I'm trying to check them out.<br><br>I'm not sure if this is the best way to communicate with the development team,<br>so I'm writing this mail also to have some indication about that. Please cc me, I'm not subscribed to the list<br><br>part of valgrind output (neon unstable development 25-12-2023)<br><br>==70026== Invalid read of size 16<br>==70026==    at 0x668FAF7: ??? (in /usr/lib/x86_64-linux-gnu/libQt6Core.so.6.6.1)<br>==70026==    by 0x575CB05: calculateHash<QStringView> (qhash.h:57)<br>==70026==    by 0x575CB05: QHashPrivate::Data<QHashPrivate::Node<QStringView, QHashDummyValue> >::findBucket(QStringView const&) const [clone .isra.0] (qhash.h:683)<br>==70026==    by 0x575FF43: findOrInsert (qhash.h:718)<br>==70026==    by 0x575FF43: QHash<QStringView, QHashDummyValue>::iterator QHash<QStringView, QHashDummyValue>::emplace_helper<QHashDummyValue>(QStringView&&, QHashDummyValue&&) [clone .isra.0] (qhash.h:1335)<br>==70026==    by 0x5761E89: emplace<QHashDummyValue> (qhash.h:1321)<br>==70026==    by 0x5761E89: insert (qset.h:158)<br>==70026==    by 0x5761E89: operator() (kconfig.cpp:325)<br>==70026==    by 0x5761E89: forEachEntryWhoseGroupStartsWith<KConfigPrivate::groupList(const QString&) const::<lambda(KEntryMapConstIterator)> > (kconfigdata_p.h:252)<br>==70026==    by 0x5761E89: KConfigPrivate::groupList(QString const&) const (kconfig.cpp:320)<br>==70026==    by 0x5771089: KConfigGroup::groupList() const (kconfiggroup.cpp:1147)<br>==70026==    by 0x1B94F929: PageDataObject::load(KConfigBase const&, QString const&) (PageDataObject.cpp:235)<br>==70026==    by 0x1B95705E: PagesModel::componentComplete() (PagesModel.cpp:99)<br>==70026==    by 0x53C1876: QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&) (in /usr/lib/x86_64-linux-gnu/libQt6Qml.so.6.6.1)<br>==70026==    by 0x54489AC: QQmlComponentPrivate::complete(QQmlEnginePrivate*, QQmlComponentPrivate::ConstructionState*) (in /usr/lib/x86_64-linux-gnu/libQt6Qml.so.6.6.1)<br>==70026==    by 0x5448CAB: QQmlComponentPrivate::completeCreate() (in /usr/lib/x86_64-linux-gnu/libQt6Qml.so.6.6.1)<br>==70026==    by 0x544AC88: QQmlComponentPrivate::createWithProperties(QObject*, QMap<QString, QVariant> const&, QQmlContext*, QQmlComponentPrivate::CreateBehavior) (in /usr/lib/x86_64-linux-gnu/libQt6Qml.so.6.6.1)<br>==70026==    by 0x54400DF: QQmlApplicationEnginePrivate::finishLoad(QQmlComponent*) (in /usr/lib/x86_64-linux-gnu/libQt6Qml.so.6.6.1)<br>==70026==  Address 0xcd3c40a is 26 bytes inside a block of size 38 alloc'd<br>==70026==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)<br>==70026==    by 0x65A5677: QArrayData::allocate(QArrayData**, long long, long long, long long, QArrayData::AllocationOption) (in /usr/lib/x86_64-linux-gnu/libQt6Core.so.6.6.1)<br>==70026==    by 0x657DCFE: QString::QString(long long, Qt::Initialization) (in /usr/lib/x86_64-linux-gnu/libQt6Core.so.6.6.1)<br>==70026==    by 0x6589D97: QString::fromUtf8(QByteArrayView) (in /usr/lib/x86_64-linux-gnu/libQt6Core.so.6.6.1)<br>==70026==    by 0x577DA4E: fromUtf8<> (qstring.h:588)<br>==70026==    by 0x577DA4E: KConfigIniBackend::parseConfig(QByteArray const&, KEntryMap&, QFlags<KConfigBackend::ParseOption>, bool) (kconfigini.cpp:157)<br>==70026==    by 0x5760C68: KConfigPrivate::parseConfigFiles() (kconfig.cpp:798)<br>==70026==    by 0x5784E81: KSharedConfig::KSharedConfig(QString const&, QFlags<KConfig::OpenFlag>, QStandardPaths::StandardLocation) (ksharedconfig.cpp:123)<br>==70026==    by 0x57854E0: KSharedConfig::openConfig(QString const&, QFlags<KConfig::OpenFlag>, QStandardPaths::StandardLocation) (ksharedconfig.cpp:88)<br>==70026==    by 0x1B957006: PagesModel::componentComplete() (PagesModel.cpp:96)<br>==70026==    by 0x53C1876: QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&) (in /usr/lib/x86_64-linux-gnu/libQt6Qml.so.6.6.1)<br>==70026==    by 0x54489AC: QQmlComponentPrivate::complete(QQmlEnginePrivate*, QQmlComponentPrivate::ConstructionState*) (in /usr/lib/x86_64-linux-gnu/libQt6Qml.so.6.6.1)<br>==70026==    by 0x5448CAB: QQmlComponentPrivate::completeCreate() (in /usr/lib/x86_64-linux-gnu/libQt6Qml.so.6.6.1)<br><br><br><br>this problem is generated in this function:<br><br><br>==70026==    by 0x5761E89: KConfigPrivate::groupList(QString const&) const (kconfig.cpp:320)<br><br>i.e.<br><br>QStringList KConfigPrivate::groupList(const QString &groupName) const<br>{<br>    const QString theGroup = groupName + QLatin1Char('\x1d');<br>    QSet<QStringView> groups;<br><br>    entryMap.forEachEntryWhoseGroupStartsWith(theGroup, [&theGroup, &groups](KEntryMapConstIterator entryMapIt) {<br>        if (isNonDeletedKey(entryMapIt)) {<br>            const QString &entryGroup = entryMapIt->first.mGroup;<br>            const auto subgroupStartPos = theGroup.size();<br>            const auto subgroupEndPos = findFirstGroupEndPos(entryGroup, subgroupStartPos);<br>            groups.insert(QStringView(entryGroup).mid(subgroupStartPos, subgroupEndPos - subgroupStartPos));<br>        }<br>    });<br><br>    return stringListFromStringViewCollection(groups);<br>}<br><br><br><br>in this line the function .mid (deprecated in QStringView) is creating a temporary object which is inserted to groups,<br><br>            groups.insert(QStringView(entryGroup).mid(subgroupStartPos, subgroupEndPos - subgroupStartPos));<br><br><br>groups is declared as :<br>QSet<QStringView> groups;<br><br>QStringView doesn't own data, it is like a wrapper/reference to a qstring.<br>so the value inserted on group is like a reference to a temporary qstring; but the qstring will be deleted while the QStringView will remain in group pointing to garbage<br><br><br>==================<br><br>this is my correction, no more complaints from valgrind about this case<br><br><br><br>tom1@tom-neon:~/kde/src/kconfig/src/core$ git diff kconfig.cpp<br>diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp<br>index b467e17e..31be6845 100644<br>--- a/src/core/kconfig.cpp<br>+++ b/src/core/kconfig.cpp<br>@@ -315,18 +315,19 @@ QStringList KConfig::groupList() const<br> QStringList KConfigPrivate::groupList(const QString &groupName) const<br> {<br>     const QString theGroup = groupName + QLatin1Char('\x1d');<br>-    QSet<QStringView> groups;<br>+    QSet<QString> groups;<br><br>     entryMap.forEachEntryWhoseGroupStartsWith(theGroup, [&theGroup, &groups](KEntryMapConstIterator entryMapIt) {<br>         if (isNonDeletedKey(entryMapIt)) {<br>             const QString &entryGroup = entryMapIt->first.mGroup;<br>             const auto subgroupStartPos = theGroup.size();<br>             const auto subgroupEndPos = findFirstGroupEndPos(entryGroup, subgroupStartPos);<br>-            groups.insert(QStringView(entryGroup).mid(subgroupStartPos, subgroupEndPos - subgroupStartPos));<br>+            groups.insert(entryGroup.mid(subgroupStartPos, subgroupEndPos - subgroupStartPos));<br>         }<br>     });<br><br>-    return stringListFromStringViewCollection(groups);<br>+    QStringList list(groups.begin(), groups.end());<br>+    return list;<br> }<br><br><br><br><br><br></div>