Просмотр исходного кода

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

Michele Caini 4 лет назад
Родитель
Сommit
baa9d7d836
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      src/entt/core/any.hpp

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

@@ -264,7 +264,7 @@ public:
      * @return This any object.
      */
     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);
         return *this;
     }