[Differential] [Commented On] D2602: Fix possible memory leaks and dangling pointers

dkurz (Denis Kurz) noreply at phabricator.kde.org
Sun Aug 28 19:37:46 BST 2016


dkurz added a comment.


  I tried to motivate the move from raw to QPointers with the memory bugs I found. First, mTreeFolderWidget was not reset to Q_NULLPTR after it was deleted, although this pointer is used in nine places in kmmainwidget.cpp to check if that widget exists, and to access it afterwards. Second, mFolderModel was reset to Q_NULLPTR in deleteWidgets, although it was not destroyed there, so that model leaked. Both problems would not have happened with QPointers. The Q_ASSERTs help find such wrong assumptions that we rely on now.
  
  Note also that the KMMailWidget code is not performance critical, so we can really afford to use the much safer QPointer. It does not add any complexity for programmers, too.
  
  If this still does not convince you, I'll revert the QPointer move and just fix the two memory problems.

REPOSITORY
  rKDEPIM KDE PIM

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

EMAIL PREFERENCES
  https://phabricator.kde.org/settings/panel/emailpreferences/

To: dkurz, #kde_pim
Cc: mlaurent, kde-pim, spencerb, dvasin, winterz, smartins, vkrause, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20160828/0f755a1b/attachment.html>


More information about the kde-pim mailing list