summaryrefslogtreecommitdiffhomepage
path: root/dev/LibCompiler/Ref.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-29 10:48:12 +0200
committerGitHub <noreply@github.com>2025-05-29 10:48:12 +0200
commit433bb5ef102b2bfa0049468be00d63011da8b973 (patch)
treee0893a30710477045a5bb085cb7a27aada425c14 /dev/LibCompiler/Ref.h
parent1ddeab9a4426abd781a5066ba79af2ba64de11d9 (diff)
parent756ee7f8dc954e27350fe5bdfbaa83b9f69780c8 (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.h5
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;