[Bf-blender-cvs] [e744673268a] master: Draw: Improve Texture assignment operator

Miguel Pozo noreply at git.blender.org
Wed Jan 25 17:12:42 CET 2023


Commit: e744673268a1144034631661ce8d897277454e25
Author: Miguel Pozo
Date:   Wed Jan 25 16:40:04 2023 +0100
Branches: master
https://developer.blender.org/rBe744673268a1144034631661ce8d897277454e25

Draw: Improve Texture assignment operator

Differential Revision: https://developer.blender.org/D17119

===================================================================

M	source/blender/draw/intern/DRW_gpu_wrapper.hh

===================================================================

diff --git a/source/blender/draw/intern/DRW_gpu_wrapper.hh b/source/blender/draw/intern/DRW_gpu_wrapper.hh
index 6d8c4cc8e87..22ad08b1cb9 100644
--- a/source/blender/draw/intern/DRW_gpu_wrapper.hh
+++ b/source/blender/draw/intern/DRW_gpu_wrapper.hh
@@ -560,10 +560,20 @@ class Texture : NonCopyable {
 
   Texture &operator=(Texture &&a)
   {
-    if (*this != a) {
+    if (this != std::addressof(a)) {
+      this->free();
+
       this->tx_ = a.tx_;
       this->name_ = a.name_;
+      this->stencil_view_ = a.stencil_view_;
+      this->mip_views_ = std::move(a.mip_views_);
+      this->layer_views_ = std::move(a.layer_views_);
+
       a.tx_ = nullptr;
+      a.name_ = nullptr;
+      a.stencil_view_ = nullptr;
+      a.mip_views_.clear();
+      a.layer_views_.clear();
     }
     return *this;
   }



More information about the Bf-blender-cvs mailing list