https://bugs.kde.org/show_bug.cgi?id=355275

--- Comment #41 from Alex Merry <alex.me...@kde.org> ---
Basically, you need to be a bit more flexible about destructor order. KParts
can be destroyed starting with the Part itself *or* starting with the central
widget.

The old behaviour was that if the widget was destroyed first, the Part would be
deleted at some point during the widget's destructor (actually in the QObject
destructor, when the destroyed() signal is emitted). This meant that, for
example, the main widget object still (mostly) existed when your KPart was
destroyed. You could get away with doing things to it (most of the time - it's
undefined behaviour, really, but it generally worked).

The new behaviour is that when the widget is destroyed, it is destroyed
completely, *then* control returns to the event loop, *then* the Part is
deleted. So you need to code your Part with the assumption that the central
widget might disappear on you at any point.

Note that the core problem (ambiguous destructor order) hasn't changed. The old
code allowed you to get away with things you shouldn't be doing, while the new
code allows you to code defensively using QPointers and the like.

You might want to try running under valgrind (with kdelibs 4.14.14 or with KF5)
to find where your assumptions about destruction ordering don't hold.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to