From 7024480b84ec1ef7ba4d371a51511bd04c48e816 Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Sun, 24 Mar 2024 21:23:07 -0400 Subject: Use shared pointer in APAttachment::get_pixmap() Necessary as the pixmap may be deleted at any moment if another caller requests a differently sized pixmap. --- src/activitypub/apattachment.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/activitypub/apattachment.h') diff --git a/src/activitypub/apattachment.h b/src/activitypub/apattachment.h index 83e9339..4b5ba0e 100644 --- a/src/activitypub/apattachment.h +++ b/src/activitypub/apattachment.h @@ -4,7 +4,7 @@ #include "fields.h" #include #include -#include +#include class APAttachment : APBase { public: @@ -12,7 +12,7 @@ public: APAttachment(APAttachmentFields fields); ~APAttachment() {}; QString get_html_render(HtmlRenderDetails render_info); - const QPixmap& get_pixmap(int width = 0, int height = 0); + std::shared_ptr get_pixmap(int width = 0, int height = 0); private: QString blurhash; @@ -22,7 +22,7 @@ private: QString path_url; // attachment URL, might be file on filesystem (make sure that the attachment dir has been found and that the path is correct) QString filename; // nicer descriptor of the attachment's path - QPixmap* pixmap = nullptr; + std::shared_ptr pixmap; struct { int width = 0; int height = 0; -- cgit v1.2.3-54-g00ecf