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.
This commit is contained in:
Nicolas Werner 2022-09-24 10:36:26 +02:00
parent ce2d4defde
commit 79ce60382a
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
2 changed files with 11 additions and 10 deletions

View file

@ -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;

View file

@ -493,7 +493,7 @@ private:
std::string last_event_id;
std::string fullyReadEventId_;
std::unique_ptr<RoomSummary> parentSummary = nullptr;
std::unique_ptr<RoomSummary, DeleteLaterDeleter> parentSummary = nullptr;
bool parentChecked = false;
};