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
Branch
fix_memory_leak_session_manager_for_review (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 12002
Build 12020: arc lint + arc unit
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.Apr 29 2019, 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.May 5 2019, 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 ↗(On Diff #57610)

can we erase an iterator inside a loop?

hriesenbeck added inline comments.May 6 2019, 1:26 PM
src/practice/sessionmanagerfixed.cpp
60 ↗(On Diff #57610)

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.May 21 2019, 10:28 PM
This revision is now accepted and ready to land.May 21 2019, 10:28 PM
This revision was automatically updated to reflect the committed changes.