D27650: ItemContainer: disconnect signals in destructor

David Edmundson noreply at phabricator.kde.org
Wed Feb 26 11:10:59 GMT 2020


davidedmundson added a comment.


  > And this used QWeakPointer leads to premature destruction of object m_layout points to.
  
  Do you have commit access?

INLINE COMMENTS

> itemcontainer.cpp:68
> +    disconnect(m_editModeTimer, &QTimer::timeout, this, nullptr);
> +    disconnect(this, &QQuickItem::parentChanged, this, nullptr);
> +

Right, this one line makes a lot of sense.

I can imagine QQuickItem::~QuickItem changes parent, and calling ItemContainer::setLayout after we've run our ItemContainers destructor means all bets are completely off. I can believe an already destroyed QPointer behaves weirdly.

Lets not change the other two. There's no chance of an event loop processing a timer event after ItemContainer:::~ItemContainer before we're auto disconnected.

REPOSITORY
  R120 Plasma Workspace

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

To: alnikiforov, ngraham, davidedmundson, mart
Cc: anthonyfieroni, plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20200226/52ae0e5e/attachment-0001.html>


More information about the Plasma-devel mailing list