Akonadi: CollectionRequester::Private::fetchCollection crash guard
ClosedPublic

Authored by winterz on Apr 30 2018, 1:05 PM.

Details

Summary

handle the case where qobject_cast<CollectionFetchJob *>(job) is 0

in case you didn't notice, I moved the Collection::List chain; declaration inside the conditional

Diff Detail

Repository
R165 Akonadi
Lint
Lint Skipped
Unit
Unit Tests Skipped
winterz created this revision.Apr 30 2018, 1:05 PM
Restricted Application added a project: KDE PIM. · View Herald TranscriptApr 30 2018, 1:05 PM
Restricted Application added a subscriber: KDE PIM. · View Herald Transcript
winterz requested review of this revision.Apr 30 2018, 1:05 PM

Hi,
When do you have this bug ?
Do you have a testcase for it ? or a bug report ?

_k_collectionReceived() is only ever connected to a CollectionFetchJob (in fetchCollection()) so I wonder how it can happen that the cast fails?

all I know is I had a crash there

I generally don't see a problem with guarding against a null pointer or a bad cast, but in this case the bad pointer would just get forwarded to _collectionsNamesReceived() in the else branch, so you need to add protection there as well.

dvratil requested changes to this revision.Apr 30 2018, 3:12 PM
This revision now requires changes to proceed.Apr 30 2018, 3:12 PM
winterz updated this revision to Diff 33389.May 1 2018, 12:42 PM

I wish I knew how the job could be bad. I can't reproduce.
I guess this doesn't cause any damage but I won't be hurt if you reject this patch. I had a core file so I made a patch

dvratil accepted this revision.May 1 2018, 8:08 PM
This revision is now accepted and ready to land.May 1 2018, 8:08 PM
This revision was automatically updated to reflect the committed changes.