Fix Use After Free MessageDelegateBase

Make sure that a `MessageDelegateBase` is not used after free by a `MessageObjectIncubator` callback by tracking them and cleaning them up on deletion of a `MessageDelegateBase`
This commit is contained in:
James Graham
2025-06-17 17:19:38 +01:00
parent 1860de12ea
commit 3183e00acc
2 changed files with 20 additions and 0 deletions

View File

@@ -126,6 +126,7 @@ class MessageDelegateBase : public TimelineDelegate
public:
MessageDelegateBase(QQuickItem *parent = nullptr);
~MessageDelegateBase();
NeochatRoomMember *author() const;
void setAuthor(NeochatRoomMember *author);
@@ -193,6 +194,8 @@ private:
bool m_isThreaded = false;
std::vector<MessageObjectIncubator *> m_activeIncubators;
QPointer<QQmlComponent> m_avatarComponent;
bool m_avatarIncubating = false;
QPointer<QQuickItem> m_avatarItem;