Help with a KMail crash

Ingo Klöcker kloecker at kde.org
Wed Dec 4 09:17:37 GMT 2024


On Mittwoch, 4. Dezember 2024 09:55:39 Mitteleuropäische Normalzeit Tomaz 
Canabrava wrote:
> Hello all, I have a quite annoying kmail crash, tried to debug but the
> codebase didn't help much.
> The crash happens in `kidentitymanager`, but I believe the culprit is in
> kmail itself.
> on KMail's `identitynpage.cpp`, method `slotRemoveIdentity` there are only
> two relevant calls:
> 
> mIPage.mIdentityList->identityTreeModel()->removeIdentities(listIdentityName
> s); save();
> 
> That in turn calls kidentitymanager's KIdentityManager::commit(),
> the commit call fails here, on the iterator access.
> 
>     for (QList<Identity>::ConstIterator it =
> d->shadowIdentities.constBegin();
>            it != d->shadowIdentities.constEnd();
>            ++it)
>  {
>         const int index = seenUOIDs.indexOf((*it).uoid());
> 
> The crash is deep down inside QHash so for me this feels like memory
> corruption:

Given that iterators are involved I suspect that shadowIdentities is modified 
while it is being iterated over which invalidates the iterator it. There are 
some signals emitted in this loop so that there's is a lot of potential for 
additional calls to KIdentityManager by connected slots including reentrancy 
of KIdentityManager::commit().

Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-devel/attachments/20241204/726a0262/attachment.sig>


More information about the kde-devel mailing list