diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-29 10:48:12 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-29 10:48:12 +0200 |
| commit | 433bb5ef102b2bfa0049468be00d63011da8b973 (patch) | |
| tree | e0893a30710477045a5bb085cb7a27aada425c14 /dev/LibCompiler/Ref.h | |
| parent | 1ddeab9a4426abd781a5066ba79af2ba64de11d9 (diff) | |
| parent | 756ee7f8dc954e27350fe5bdfbaa83b9f69780c8 (diff) | |
Merge pull request #6 from nekernel-org/dev
0.0.2e3
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; |
