Fix memory leak.
AbandonedPublic

Authored by cordlandwehr on May 7 2016, 8:46 PM.

Details

Reviewers
mwolff
kfunk
Group Reviewers
KDevelop

Diff Detail

Repository
R52 KDevelop: PHP Support
Branch
5.0
Lint
No Linters Available
Unit
No Unit Test Coverage
cordlandwehr updated this revision to Diff 3689.May 7 2016, 8:46 PM
cordlandwehr retitled this revision from to Fix memory leak..
cordlandwehr updated this object.
cordlandwehr edited the test plan for this revision. (Show Details)
cordlandwehr added a reviewer: KDevelop.
Restricted Application added a subscriber: kdevelop-devel. ยท View Herald TranscriptMay 7 2016, 8:46 PM
apol added a subscriber: apol.May 9 2016, 1:03 AM

How hard would it be to change to QScopedPointer?

kfunk requested changes to this revision.May 9 2016, 6:28 AM
kfunk added a reviewer: kfunk.
kfunk added a subscriber: kfunk.

Those two are deleted through QObject-relationship, aren't they? Both objects are children of the LanguageSupport instance.

This revision now requires changes to proceed.May 9 2016, 6:28 AM

Hmm, I see your point. To put this change in context: I have run KDevelop inside Valgrind since I wanted to debug a crash-on-close problem. Valgrind however showed tons of incomplete deletions of LanguageSupport objects, which vanished after adding these explicit deletes.
Do you think that these Valgrind errors may be caused by having a crash in KDevelop before the QObject children relationships could take care for deleting the m_highlighting and m_refactoring objects?

kfunk added a comment.May 9 2016, 6:02 PM

Hmm, I see your point. To put this change in context: I have run KDevelop inside Valgrind since I wanted to debug a crash-on-close problem. Valgrind however showed tons of incomplete deletions of LanguageSupport objects, which vanished after adding these explicit deletes.

I see.

Do you think that these Valgrind errors may be caused by having a crash in KDevelop before the QObject children relationships could take care for deleting the m_highlighting and m_refactoring objects?

Likely, yes. I've been running KDevelop under ASAN for a while (with leak reports enabled), and I fixed tons of leaks already. I would have seen this one. You agree that this deletion should be taken care of via QObject relationship, right? In that case, we can abandon this patch.

mwolff requested changes to this revision.May 9 2016, 6:27 PM
mwolff added a reviewer: mwolff.
mwolff added a subscriber: mwolff.

Leak checking after any kind of abnormal program termination is unreliable. If you saw this after a crash then it would explain this issue.

cordlandwehr abandoned this revision.May 10 2016, 5:12 PM

Yeah, this delete is ensured by the QObject child relationships.