diff --git a/common/lc_texture.cpp b/common/lc_texture.cpp index 819e53e5..1dbd01e2 100644 --- a/common/lc_texture.cpp +++ b/common/lc_texture.cpp @@ -176,9 +176,13 @@ bool lcTexture::Load(const QString& FileName, int Flags) if (!Image.FileLoad(FileName)) return false; - + + mLoading = true; + SetImage(std::move(Image), Flags); + mLoading = false; + return true; } @@ -188,9 +192,13 @@ bool lcTexture::Load(lcMemFile& File, int Flags) if (!Image.FileLoad(File)) return false; - + + mLoading = true; + SetImage(std::move(Image), Flags); - + + mLoading = false; + return true; } diff --git a/common/lc_texture.h b/common/lc_texture.h index 74dbb3ac..4a5e4201 100644 --- a/common/lc_texture.h +++ b/common/lc_texture.h @@ -67,7 +67,7 @@ public: bool NeedsUpload() const { - return mTexture == 0 && !mImages.empty(); + return !mLoading && mTexture == 0 && !mImages.empty(); } int GetFlags() const @@ -99,6 +99,7 @@ protected: QAtomicInt mRefCount; std::vector mImages; int mFlags; + bool mLoading = false; }; lcTexture* lcLoadTexture(const QString& FileName, int Flags);