diff options
Diffstat (limited to 'dev/LibCompiler/Ref.h')
| -rw-r--r-- | dev/LibCompiler/Ref.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/dev/LibCompiler/Ref.h b/dev/LibCompiler/Ref.h index c5188b5..60eafc3 100644 --- a/dev/LibCompiler/Ref.h +++ b/dev/LibCompiler/Ref.h @@ -22,14 +22,15 @@ class Ref final { ~Ref() { if (m_Strong) { - (*m_Class).~T(); + if (m_Class) delete m_Class; + m_Class = nullptr; } } LIBCOMPILER_COPY_DEFAULT(Ref); public: - explicit Ref(T cls, const Bool& strong = false) : m_Class(&cls), m_Strong(strong) {} + explicit Ref(T* cls, const Bool& strong = false) : m_Class(cls), m_Strong(strong) {} Ref& operator=(T ref) { *m_Class = ref; |
