Am Freitag, 29. Dezember 2023, 10:53:45 CET schrieb Tommaso Massimi: > running plasma-systemmonitor with valgring a lot of problems are declared, > I'm trying to check them out. > > I'm not sure if this is the best way to communicate with the development > team, > so I'm writing this mail also to have some indication about that. Please cc > me, I'm not subscribed to the list > > part of valgrind output (neon unstable development 25-12-2023) > > ==70026== Invalid read of size 16 > ==70026== at 0x668FAF7: ??? (in > /usr/lib/x86_64-linux-gnu/libQt6Core.so.6.6.1) > ==70026== by 0x575CB05: calculateHash<QStringView> (qhash.h:57) > ==70026== by 0x575CB05: > QHashPrivate::Data<QHashPrivate::Node<QStringView, QHashDummyValue> > > >::findBucket(QStringView const&) const [clone .isra.0] (qhash.h:683) > > ==70026== by 0x575FF43: findOrInsert (qhash.h:718) > ==70026== by 0x575FF43: QHash<QStringView, QHashDummyValue>::iterator > QHash<QStringView, > QHashDummyValue>::emplace_helper<QHashDummyValue>(QStringView&&, > QHashDummyValue&&) [clone .isra.0] (qhash.h:1335) > ==70026== by 0x5761E89: emplace<QHashDummyValue> (qhash.h:1321) > ==70026== by 0x5761E89: insert (qset.h:158) > ==70026== by 0x5761E89: operator() (kconfig.cpp:325) > ==70026== by 0x5761E89: > forEachEntryWhoseGroupStartsWith<KConfigPrivate::groupList(const QString&) > const::<lambda(KEntryMapConstIterator)> > (kconfigdata_p.h:252) > ==70026== by 0x5761E89: KConfigPrivate::groupList(QString const&) const > (kconfig.cpp:320) > ==70026== by 0x5771089: KConfigGroup::groupList() const > (kconfiggroup.cpp:1147) > ==70026== by 0x1B94F929: PageDataObject::load(KConfigBase const&, > QString const&) (PageDataObject.cpp:235) > ==70026== by 0x1B95705E: PagesModel::componentComplete() > (PagesModel.cpp:99) > ==70026== by 0x53C1876: > QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&) (in > /usr/lib/x86_64-linux-gnu/libQt6Qml.so.6.6.1) > ==70026== by 0x54489AC: > QQmlComponentPrivate::complete(QQmlEnginePrivate*, > QQmlComponentPrivate::ConstructionState*) (in > /usr/lib/x86_64-linux-gnu/libQt6Qml.so.6.6.1) > ==70026== by 0x5448CAB: QQmlComponentPrivate::completeCreate() (in > /usr/lib/x86_64-linux-gnu/libQt6Qml.so.6.6.1) > ==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) > ==70026== by 0x54400DF: > QQmlApplicationEnginePrivate::finishLoad(QQmlComponent*) (in > /usr/lib/x86_64-linux-gnu/libQt6Qml.so.6.6.1) > ==70026== Address 0xcd3c40a is 26 bytes inside a block of size 38 alloc'd > ==70026== at 0x4848899: malloc (in > /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) > ==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) > ==70026== by 0x657DCFE: QString::QString(long long, Qt::Initialization) > (in /usr/lib/x86_64-linux-gnu/libQt6Core.so.6.6.1) > ==70026== by 0x6589D97: QString::fromUtf8(QByteArrayView) (in > /usr/lib/x86_64-linux-gnu/libQt6Core.so.6.6.1) > ==70026== by 0x577DA4E: fromUtf8<> (qstring.h:588) > ==70026== by 0x577DA4E: KConfigIniBackend::parseConfig(QByteArray > const&, KEntryMap&, QFlags<KConfigBackend::ParseOption>, bool) > (kconfigini.cpp:157) > ==70026== by 0x5760C68: KConfigPrivate::parseConfigFiles() > (kconfig.cpp:798) > ==70026== by 0x5784E81: KSharedConfig::KSharedConfig(QString const&, > QFlags<KConfig::OpenFlag>, QStandardPaths::StandardLocation) > (ksharedconfig.cpp:123) > ==70026== by 0x57854E0: KSharedConfig::openConfig(QString const&, > QFlags<KConfig::OpenFlag>, QStandardPaths::StandardLocation) > (ksharedconfig.cpp:88) > ==70026== by 0x1B957006: PagesModel::componentComplete() > (PagesModel.cpp:96) > ==70026== by 0x53C1876: > QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&) (in > /usr/lib/x86_64-linux-gnu/libQt6Qml.so.6.6.1) > ==70026== by 0x54489AC: > QQmlComponentPrivate::complete(QQmlEnginePrivate*, > QQmlComponentPrivate::ConstructionState*) (in > /usr/lib/x86_64-linux-gnu/libQt6Qml.so.6.6.1) > ==70026== by 0x5448CAB: QQmlComponentPrivate::completeCreate() (in > /usr/lib/x86_64-linux-gnu/libQt6Qml.so.6.6.1) > > > > this problem is generated in this function: > > > ==70026== by 0x5761E89: KConfigPrivate::groupList(QString const&) const > (kconfig.cpp:320) > > i.e. > > QStringList KConfigPrivate::groupList(const QString &groupName) const > { > const QString theGroup = groupName + QLatin1Char('\x1d'); > QSet<QStringView> groups; > > entryMap.forEachEntryWhoseGroupStartsWith(theGroup, [&theGroup, > &groups](KEntryMapConstIterator entryMapIt) { > if (isNonDeletedKey(entryMapIt)) { > const QString &entryGroup = entryMapIt->first.mGroup; > const auto subgroupStartPos = theGroup.size(); > const auto subgroupEndPos = findFirstGroupEndPos(entryGroup, > subgroupStartPos); > groups.insert(QStringView(entryGroup).mid(subgroupStartPos, > subgroupEndPos - subgroupStartPos)); > } > }); > > return stringListFromStringViewCollection(groups); > } > > > > in this line the function .mid (deprecated in QStringView) is creating a > temporary object which is inserted to groups, > > groups.insert(QStringView(entryGroup).mid(subgroupStartPos, > subgroupEndPos - subgroupStartPos)); > > > groups is declared as : > QSet<QStringView> groups; > > QStringView doesn't own data, it is like a wrapper/reference to a qstring. > 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
QStringView::mid() returns a QStringView though, no? Which still points to the raw data of the original QString I would assume? Which "temporary qstring" would you think of here? Caught this email while going out-of-door, so just a first-minute reply, will have a look later CET today (being the one who touched that code last). Cheers Friedrich