D4970: Get rid of QWeakPointer

David Edmundson noreply at phabricator.kde.org
Thu Mar 9 13:09:59 UTC 2017


davidedmundson added a comment.


  >> From the the documentation of QObject::~QObject: "Warning: Deleting a QObject while pending events are waiting to be delivered can cause a crash."
  > 
  > It can happens only if an object lives in a different thread. But the ErrorOverlay - is a widget, which should live in a main thread.
  
  That is not true.
  
  If I have two things that connect to the same signal, I get two things in my event queue. Multiple things in the event queue happens all the time.
  If one slot deletes something another second slot implicitly relies on, I can get a crash, no threads needed.
  
  In this particular case as nothing is connected to that widget it seems you're right it wont' be a problem, but not for the reason you said.
  
  FWIW, QPointer is the natural replacement for QWeakPointer and it has practically no overhead.

REPOSITORY
  R122 Powerdevil

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

To: denisshienkov, afiestas, ltoscano, volkov
Cc: davidedmundson, plasma-devel, volkov, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20170309/bec580d7/attachment.html>


More information about the Plasma-devel mailing list