Some further belt and braces to ensure that we don't crash in the timeline
Some further belt and braces to ensure that we don't crash in the timeline. This does the following: - Checks all callback inputs - Makes sure that any objects are cleaned up from incubators when deleting the delegate as it turns out that clear() doesn't do this. Hopefully this stops callbacks into an already deleted parent. Hopefully helps with https://crash-reports.kde.org/organizations/kde/issues/261627/events/0b6bef500c5641e1924aa0bc2b0c11bd/
This commit is contained in:
committed by
Tobias Fella
parent
bec9f36bce
commit
5fd9f07664
@@ -52,6 +52,9 @@ MessageDelegateBase::~MessageDelegateBase()
|
||||
{
|
||||
for (const auto &incubator : m_activeIncubators) {
|
||||
incubator->clear();
|
||||
if (const auto object = qobject_cast<QQuickItem *>(incubator->object())) {
|
||||
cleanupItem(object);
|
||||
}
|
||||
delete incubator;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,12 +235,20 @@ private:
|
||||
void hoverLeaveEvent(QHoverEvent *event) override;
|
||||
|
||||
std::function<void(QQuickItem *)> m_objectInitialCallback = [this](QQuickItem *object) {
|
||||
if (!object) {
|
||||
return;
|
||||
}
|
||||
|
||||
object->setParentItem(this);
|
||||
connect(object, &QQuickItem::implicitWidthChanged, this, &MessageDelegateBase::markAsDirty);
|
||||
connect(object, &QQuickItem::implicitHeightChanged, this, &MessageDelegateBase::markAsDirty);
|
||||
connect(object, &QQuickItem::visibleChanged, this, &MessageDelegateBase::markAsDirty);
|
||||
};
|
||||
std::function<void(MessageObjectIncubator *)> m_errorCallback = [this](MessageObjectIncubator *incubator) {
|
||||
if (!incubator) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (incubator->object()) {
|
||||
incubator->object()->deleteLater();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user