From 76182d018f9973ac7b1170de255b187954885c69 Mon Sep 17 00:00:00 2001 From: evgeny Date: Tue, 8 Sep 2026 01:01:28 +0300 Subject: [PATCH] =?UTF-8?q?chatgui:=20QPointer-=D0=B7=D0=B0=D1=89=D0=B8?= =?UTF-8?q?=D1=82=D0=B0=20=D0=BF=D1=80=D0=B8=20=D0=B3=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BF=D1=80=D0=B5=D0=B2=D1=8C?= =?UTF-8?q?=D1=8E=20=D0=B2=20=D1=84=D0=BE=D0=BD=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/chatgui/src/messagelist.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/chatgui/src/messagelist.cpp b/tools/chatgui/src/messagelist.cpp index 18d00093..46506a1a 100644 --- a/tools/chatgui/src/messagelist.cpp +++ b/tools/chatgui/src/messagelist.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -749,13 +750,16 @@ void MessageList::onAttachmentDownloaded(const QString& chId, int64_t msgId) { QString fp = item->data(MsgVoiceFileRole).toString(); QString thumbPath = fp + ".jpg"; if (!fp.isEmpty() && QFile::exists(fp) && !QFile::exists(thumbPath)) { - std::thread([this, fp, thumbPath]() { + QPointer self(this); + std::thread([self, fp, thumbPath]() { int rc = video_extract_thumbnail(fp.toUtf8().constData(), thumbPath.toUtf8().constData(), 320); DEBUG_DEBUG(DEBUG_CATEGORY_VIDEO, "MessageList: thumbnail %s rc=%d", qPrintable(thumbPath), rc); - QMetaObject::invokeMethod(this, [this]() { m_view->viewport()->update(); }, - Qt::QueuedConnection); + if (self) { + QMetaObject::invokeMethod(self, [self]() { self->m_view->viewport()->update(); }, + Qt::QueuedConnection); + } }).detach(); } }