From 76fdbfaa2fe51f20c6a2ec944e3e3ec8cfaac009 Mon Sep 17 00:00:00 2001 From: RickyRister <42636155+RickyRister@users.noreply.github.com> Date: Sun, 29 Jun 2025 19:21:12 -0700 Subject: [PATCH] [PictureLoader] Dumb hack to fix segfault (#6010) --- .../client/ui/picture_loader/picture_loader_worker_work.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/client/ui/picture_loader/picture_loader_worker_work.cpp b/cockatrice/src/client/ui/picture_loader/picture_loader_worker_work.cpp index a92116721..b94772b24 100644 --- a/cockatrice/src/client/ui/picture_loader/picture_loader_worker_work.cpp +++ b/cockatrice/src/client/ui/picture_loader/picture_loader_worker_work.cpp @@ -194,7 +194,10 @@ QImage PictureLoaderWorkerWork::tryLoadImageFromReply(QNetworkReply *reply) void PictureLoaderWorkerWork::concludeImageLoad(const QImage &image) { emit imageLoaded(cardToDownload.getCard(), image); - this->deleteLater(); + + // Delayed delete is a dumb hack to prevent segfaults due to calling methods on a deleted Work + // TODO: find a more proper way to structure this whole thing + QTimer::singleShot(2000, this, &QObject::deleteLater); } void PictureLoaderWorkerWork::picDownloadChanged()