sitter added inline comments.

INLINE COMMENTS

> anthonyfieroni wrote in kpropertiesdialog.cpp:1114
> OK, it can be a problem since we can have many objects of KFilePropsPlugin 
> thus lambda will extend service ptr life to the process end, which can result 
> in memory leak (it's not leak) But since it's a plugin we don't expect a tons 
> of objects, but i'm fine to make service a class scope var to not outlive the 
> plugin.

I'm pretty sure that isn't true.

KFilePropsPlugin are the tabs inside the properties dialog. They get 
instantiated for each dialog and destroyed when the dialog is destroyed. They 
are not persistent throughout the life time of the process. 
The lamda in this case is scoped to the internal QFunctorSlotObject or whatever 
it's called and that is held by the QObject. When the dialog gets destroyed, it 
destroys the KFilePropsPlugin instance and that disconnects the signal 
triggering the QFunctorSlotObject to get deleted, which in turn causes the 
lambda to lose scope and clean up, destroying its pointer copies.
TLDR: the lambda and all its copies do not outlive the property dialog it 
belongs to.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D26650

To: shubham, broulik, ngraham
Cc: sitter, meven, anthonyfieroni, kde-frameworks-devel, LeGast00n, GB_2, 
michaelh, ngraham, bruns

Reply via email to