diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2022-09-24 10:36:26 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2022-09-24 10:36:26 +0200 |
commit | 79ce60382ac6cf26a1a57401d9a898b39db9c457 (patch) | |
tree | 75c0d31e8dc5f9fc08e9079682227f2a4c842342 /src/timeline | |
parent | Try to handle rate limiting (diff) | |
download | nheko-79ce60382ac6cf26a1a57401d9a898b39db9c457.tar.xz |
Fix crash when deleting room summary
Since this is used across different threads, we have to delete it on the event loop. Thank you, q234rty, for the help with debugging this.
Diffstat (limited to 'src/timeline')
-rw-r--r-- | src/timeline/InputBar.h | 17 | ||||
-rw-r--r-- | src/timeline/TimelineModel.h | 4 |
2 files changed, 11 insertions, 10 deletions
diff --git a/src/timeline/InputBar.h b/src/timeline/InputBar.h index 816d4e37..8590d84f 100644 --- a/src/timeline/InputBar.h +++ b/src/timeline/InputBar.h @@ -25,6 +25,15 @@ class CombinedImagePackModel; class QMimeData; class QDropEvent; +struct DeleteLaterDeleter +{ + void operator()(QObject *p) + { + if (p) + p->deleteLater(); + } +}; + enum class MarkdownOverride { NOT_SPECIFIED, // no override set @@ -278,14 +287,6 @@ private: bool uploading_ = false; bool containsAtRoom_ = false; - struct DeleteLaterDeleter - { - void operator()(QObject *p) - { - if (p) - p->deleteLater(); - } - }; using UploadHandle = std::unique_ptr<MediaUpload, DeleteLaterDeleter>; std::vector<UploadHandle> unconfirmedUploads; std::vector<UploadHandle> runningUploads; diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h index ea6daa34..a098f1bd 100644 --- a/src/timeline/TimelineModel.h +++ b/src/timeline/TimelineModel.h @@ -493,8 +493,8 @@ private: std::string last_event_id; std::string fullyReadEventId_; - std::unique_ptr<RoomSummary> parentSummary = nullptr; - bool parentChecked = false; + std::unique_ptr<RoomSummary, DeleteLaterDeleter> parentSummary = nullptr; + bool parentChecked = false; }; template<class T> |