diff options
author | ConfuSomu | 2024-03-24 21:23:07 -0400 |
---|---|---|
committer | ConfuSomu | 2024-03-24 21:23:07 -0400 |
commit | 7024480b84ec1ef7ba4d371a51511bd04c48e816 (patch) | |
tree | db03b06bf9d27e29ec4b90ada127f1aaeb6ff382 /src/activitypub/apattachment.h | |
parent | 4142690acd68dde59d0a6b16ccdda12f9195f304 (diff) | |
download | ActorViewer-7024480b84ec1ef7ba4d371a51511bd04c48e816.tar ActorViewer-7024480b84ec1ef7ba4d371a51511bd04c48e816.tar.gz ActorViewer-7024480b84ec1ef7ba4d371a51511bd04c48e816.zip |
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.
Diffstat (limited to 'src/activitypub/apattachment.h')
-rw-r--r-- | src/activitypub/apattachment.h | 6 |
1 files changed, 3 insertions, 3 deletions
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 <QPixmap> #include <array> -#include <vector> +#include <memory> 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<QPixmap> 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<QPixmap> pixmap; struct { int width = 0; int height = 0; |