Fix ResultIterator
ClosedPublic

Authored by aacid on Jan 13 2019, 9:58 PM.

Details

Summary

Previously it had a copy contructor that just assigned the d pointer
of the rhs to the new object, meaning both objects had the same d pointer
and thus we would end up with a double delete when both got deleted.

Now i've made the copy contructor and assignment operator non existing to have this problem

But we need a move constructor since the class is typically used as

Baloo::ResultIterator it = query.exec();

and that stops working if we delete the regular copy and assignment operators

Diff Detail

Repository
R293 Baloo
Branch
arcpatch-D18237
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 7682
Build 7700: arc lint + arc unit
aacid requested review of this revision.Jan 13 2019, 9:58 PM
aacid created this revision.
aacid set the repository for this revision to R293 Baloo.Jan 16 2019, 10:36 PM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptJan 16 2019, 10:36 PM
Restricted Application added subscribers: Baloo, kde-frameworks-devel. · View Herald Transcript
apol added a subscriber: apol.Jan 29 2019, 5:40 PM

Do you think BC is a problem here then? Won't applications be using it as you described start failing?

aacid abandoned this revision.Jan 29 2019, 6:31 PM

Hmmm, you're right, this is Source Compatible but not Binary Compatible.

I guess i'll discard this and hope people don't really misuses it.

apol added a comment.Jan 29 2019, 7:22 PM

Maybe it could make sense to deprecate the copy constructor and add the move operator?

aacid reclaimed this revision.Jan 29 2019, 10:46 PM

Ok, that makes sense

aacid updated this revision to Diff 50533.Jan 29 2019, 10:48 PM

update so not to break BC

apol accepted this revision.Jan 30 2019, 9:48 AM
This revision is now accepted and ready to land.Jan 30 2019, 9:48 AM
aacid closed this revision.Jan 30 2019, 5:06 PM
bruns added a comment.Jan 31 2019, 7:02 PM

The correct way to fix this is by allocating a new ResultIteratorPrivate and "copying" the QStringList.

bruns added a comment.Jan 31 2019, 7:23 PM

Oh, and you forgot to undelete the operator=, so this is still BIC ...

aacid added a comment.Jan 31 2019, 9:17 PM

Oh, and you forgot to undelete the operator=, so this is still BIC ...

No, that is not BIC