mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
run destructor of Frames in gui thread
This commit is contained in:
parent
0ada53a3c1
commit
2fc799f85a
2 changed files with 11 additions and 0 deletions
|
@ -198,6 +198,15 @@ namespace detail {
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
// IMAGE2
|
// IMAGE2
|
||||||
|
Image::~Image()
|
||||||
|
{
|
||||||
|
// run destructor of Frames in gui thread
|
||||||
|
if (!isGuiThread())
|
||||||
|
{
|
||||||
|
postToThread([frames = this->frames_.release()]() { delete frames; });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImagePtr Image::fromUrl(const Url &url, qreal scale)
|
ImagePtr Image::fromUrl(const Url &url, qreal scale)
|
||||||
{
|
{
|
||||||
static std::unordered_map<Url, std::weak_ptr<Image>> cache;
|
static std::unordered_map<Url, std::weak_ptr<Image>> cache;
|
||||||
|
|
|
@ -49,6 +49,8 @@ using ImagePtr = std::shared_ptr<Image>;
|
||||||
class Image : public std::enable_shared_from_this<Image>, boost::noncopyable
|
class Image : public std::enable_shared_from_this<Image>, boost::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
~Image();
|
||||||
|
|
||||||
static ImagePtr fromUrl(const Url &url, qreal scale = 1);
|
static ImagePtr fromUrl(const Url &url, qreal scale = 1);
|
||||||
static ImagePtr fromPixmap(const QPixmap &pixmap, qreal scale = 1);
|
static ImagePtr fromPixmap(const QPixmap &pixmap, qreal scale = 1);
|
||||||
static ImagePtr getEmpty();
|
static ImagePtr getEmpty();
|
||||||
|
|
Loading…
Reference in a new issue