D17039: ASAN: Fix leak in KAStatsFavoritesModel
This revision was automatically updated to reflect the committed changes. Closed by commit R119:7f83492a654c: ASAN: Fix leak in KAStatsFavoritesModel (authored by kfunk). REPOSITORY R119 Plasma Desktop CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D17039?vs=45867&id=46246 REVISION DETAIL https://phabricator.kde.org/D17039 AFFECTED FILES applets/kicker/plugin/kastatsfavoritesmodel.cpp To: kfunk, davidedmundson, ivan Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D17039: ASAN: Fix leak in KAStatsFavoritesModel
ivan accepted this revision. ivan added a comment. This revision is now accepted and ready to land. Ok, +2 from me then REPOSITORY R119 Plasma Desktop BRANCH master REVISION DETAIL https://phabricator.kde.org/D17039 To: kfunk, davidedmundson, ivan Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D17039: ASAN: Fix leak in KAStatsFavoritesModel
kfunk added a comment. I think the `QSharedPointer` overhead is very much negligible in this case here. And doesn't require refactoring of the original code. This is not performance sensitive code (compared to the costs of the QAIM-modifications), no? If you think the memory leak can be fixed differently, shoot. INLINE COMMENTS > kastatsfavoritesmodel.cpp:297 > > m_itemEntries[resource] > = m_itemEntries[entry->id()] With `std::unique_ptr` we'd run into a couple of problems, like in this place here: Multiple copies would be needed. REPOSITORY R119 Plasma Desktop REVISION DETAIL https://phabricator.kde.org/D17039 To: kfunk, davidedmundson, ivan Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D17039: ASAN: Fix leak in KAStatsFavoritesModel
ivan added a comment. Using a shared pointer seems like a pessimization. Could this be done with std::unique_ptr? REPOSITORY R119 Plasma Desktop REVISION DETAIL https://phabricator.kde.org/D17039 To: kfunk, davidedmundson, ivan Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D17039: ASAN: Fix leak in KAStatsFavoritesModel
kfunk created this revision. Herald added a project: Plasma. Herald added a subscriber: plasma-devel. kfunk requested review of this revision. REVISION SUMMARY Trace: Direct leak of 336 byte(s) in 6 object(s) allocated from: #0 0x544cc0 in operator new(unsigned long) (/home/kfunk/devel/install/kf5/bin/plasmashell+0x544cc0) #1 0x7fbad15cddaf in KAStatsFavoritesModel::Private::entryForResource(QString const&) const /home/kfunk/devel/src/kf5/plasma-desktop/applets/kicker/plugin/kastatsfavoritesmodel.cpp:171:24 #2 0x7fbad15b2d8e in KAStatsFavoritesModel::Private::addResult(QString const&, int, bool) /home/kfunk/devel/src/kf5/plasma-desktop/applets/kicker/plugin/kastatsfavoritesmodel.cpp:280:22 #3 0x7fbad15b044f in KAStatsFavoritesModel::Private::Private(KAStatsFavoritesModel*, QString) /home/kfunk/devel/src/kf5/plasma-desktop/applets/kicker/plugin/kastatsfavoritesmodel.cpp:233:13 #4 0x7fbad15a78ea in KAStatsFavoritesModel::initForClient(QString const&) /home/kfunk/devel/src/kf5/plasma-desktop/applets/kicker/plugin/kastatsfavoritesmodel.cpp:485:13 ... REPOSITORY R119 Plasma Desktop BRANCH master REVISION DETAIL https://phabricator.kde.org/D17039 AFFECTED FILES applets/kicker/plugin/kastatsfavoritesmodel.cpp To: kfunk Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
