From 2eed4954c762bb8050e40798c3d9f1d3998324d1 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 23 May 2025 03:48:06 +0200 Subject: feat!(LibCompiler): Codebase and diagram has been improved. Signed-off-by: Amlal El Mahrouss --- dev/LibCompiler/Ref.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'dev/LibCompiler/Ref.h') diff --git a/dev/LibCompiler/Ref.h b/dev/LibCompiler/Ref.h index c5188b5..ffc11c0 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(); + 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; -- cgit v1.2.3 From 756ee7f8dc954e27350fe5bdfbaa83b9f69780c8 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 29 May 2025 10:40:43 +0200 Subject: fix: Ref.h: Don't delete NULL pointer. Signed-off-by: Amlal El Mahrouss --- dev/LibCompiler/Ref.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dev/LibCompiler/Ref.h') diff --git a/dev/LibCompiler/Ref.h b/dev/LibCompiler/Ref.h index ffc11c0..60eafc3 100644 --- a/dev/LibCompiler/Ref.h +++ b/dev/LibCompiler/Ref.h @@ -22,7 +22,7 @@ class Ref final { ~Ref() { if (m_Strong) { - delete m_Class; + if (m_Class) delete m_Class; m_Class = nullptr; } } -- cgit v1.2.3