Browse Source

any: avoid invalid state from assignment operator for non-copyable types

Michele Caini 4 years ago
parent
commit
baa9d7d836
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/entt/core/any.hpp

+ 1 - 1
src/entt/core/any.hpp

@@ -264,7 +264,7 @@ public:
      * @return This any object.
      * @return This any object.
      */
      */
     basic_any & operator=(const basic_any &other) {
     basic_any & operator=(const basic_any &other) {
-        vtable(operation::DTOR, *this, nullptr);
+        std::exchange(vtable, &basic_vtable<void>)(operation::DTOR, *this, nullptr);
         other.vtable(operation::COPY, other, this);
         other.vtable(operation::COPY, other, this);
         return *this;
         return *this;
     }
     }