summaryrefslogtreecommitdiff
path: root/src/resources/resource.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/resource.h')
-rw-r--r--src/resources/resource.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/resources/resource.h b/src/resources/resource.h
index 9fe00f3d..e1f37d73 100644
--- a/src/resources/resource.h
+++ b/src/resources/resource.h
@@ -120,6 +120,20 @@ public:
return *this;
}
+ // Move assignment operator
+ ResourceRef &operator=(ResourceRef &&other)
+ {
+ if (this != &other)
+ {
+ if (mResource)
+ mResource->decRef();
+
+ mResource = other.mResource;
+ other.mResource = nullptr;
+ }
+ return *this;
+ }
+
// Allow dereferencing
RESOURCE *operator->() const
{ return mResource; }
@@ -131,6 +145,15 @@ public:
operator RESOURCE *() const
{ return mResource; }
+ /**
+ * Releases the resource without decrementing the reference count!
+ *
+ * This is currently necessary to avoid calls to decRef on instances of
+ * SubImage, which are not reference counted resources.
+ */
+ void release()
+ { mResource = nullptr; }
+
private:
RESOURCE *mResource;
};