Fix for memory leak in SessionManagerFixed
ClosedPublic

Authored by hriesenbeck on Nov 27 2018, 8:20 PM.

Details

Summary

An already by Inge Wallin marked memory leak is fixed by removing the
choosen test entries from the source list after copying them into the
destination list. So at the end of the choosing process only unused
entries remaining in the source list which are deleted before reusing
the list.

Depends on D17180

Diff Detail

Repository
R340 Parley
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
hriesenbeck created this revision.Nov 27 2018, 8:20 PM
Restricted Application added a project: KDE Edu. · View Herald TranscriptNov 27 2018, 8:20 PM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
hriesenbeck requested review of this revision.Nov 27 2018, 8:20 PM

Missed to set a reviewer.

apol added a subscriber: apol.Mon, Apr 29, 12:05 AM

+1 on the patch, like for the patch we depend on, it could be interesting to get this unit tested.

hriesenbeck updated this revision to Diff 57610.Sun, May 5, 8:17 PM

Update to patch this one is depending on

The just submitted unit tests for the patch we depend on are
implying testing of SessionManagerFixed::initializeTraining()
where the memory leak fix is located.

tcanabrava added inline comments.
src/practice/sessionmanagerfixed.cpp
60

can we erase an iterator inside a loop?

hriesenbeck added inline comments.Mon, May 6, 1:26 PM
src/practice/sessionmanagerfixed.cpp
60

Yes, with QList that works.
Erase() removes the list entry the iterator is pointing to and returns an iterator to the following element. That's why the iterator increment operator is in the else block.

Update to patch this one is depending on

aacid accepted this revision.Tue, May 21, 10:28 PM
This revision is now accepted and ready to land.Tue, May 21, 10:28 PM
This revision was automatically updated to reflect the committed changes.