mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
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:
parent
ce2d4defde
commit
79ce60382a
2 changed files with 11 additions and 10 deletions
|
@ -25,6 +25,15 @@ class CombinedImagePackModel;
|
||||||
class QMimeData;
|
class QMimeData;
|
||||||
class QDropEvent;
|
class QDropEvent;
|
||||||
|
|
||||||
|
struct DeleteLaterDeleter
|
||||||
|
{
|
||||||
|
void operator()(QObject *p)
|
||||||
|
{
|
||||||
|
if (p)
|
||||||
|
p->deleteLater();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
enum class MarkdownOverride
|
enum class MarkdownOverride
|
||||||
{
|
{
|
||||||
NOT_SPECIFIED, // no override set
|
NOT_SPECIFIED, // no override set
|
||||||
|
@ -278,14 +287,6 @@ private:
|
||||||
bool uploading_ = false;
|
bool uploading_ = false;
|
||||||
bool containsAtRoom_ = false;
|
bool containsAtRoom_ = false;
|
||||||
|
|
||||||
struct DeleteLaterDeleter
|
|
||||||
{
|
|
||||||
void operator()(QObject *p)
|
|
||||||
{
|
|
||||||
if (p)
|
|
||||||
p->deleteLater();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
using UploadHandle = std::unique_ptr<MediaUpload, DeleteLaterDeleter>;
|
using UploadHandle = std::unique_ptr<MediaUpload, DeleteLaterDeleter>;
|
||||||
std::vector<UploadHandle> unconfirmedUploads;
|
std::vector<UploadHandle> unconfirmedUploads;
|
||||||
std::vector<UploadHandle> runningUploads;
|
std::vector<UploadHandle> runningUploads;
|
||||||
|
|
|
@ -493,8 +493,8 @@ private:
|
||||||
std::string last_event_id;
|
std::string last_event_id;
|
||||||
std::string fullyReadEventId_;
|
std::string fullyReadEventId_;
|
||||||
|
|
||||||
std::unique_ptr<RoomSummary> parentSummary = nullptr;
|
std::unique_ptr<RoomSummary, DeleteLaterDeleter> parentSummary = nullptr;
|
||||||
bool parentChecked = false;
|
bool parentChecked = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|
Loading…
Reference in a new issue