From 978911f2ede81fc5354858da63c22948df50833c Mon Sep 17 00:00:00 2001
From: Doralitze <doralitze@chaotikum.org>
Date: Tue, 12 Mar 2019 10:18:34 +0100
Subject: [PATCH] fix: better handling of std::shared_ptr due to new c++20

---
 src/ui/view.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/ui/view.cpp b/src/ui/view.cpp
index 4501cc9..74d972b 100644
--- a/src/ui/view.cpp
+++ b/src/ui/view.cpp
@@ -7,9 +7,11 @@ namespace rmrf::ui {
 
 view::view(std::shared_ptr<view> parent) : parent_view{parent} {
 	if(this->parent_view != nullptr) {
-		std::shared_ptr<new_child_event> child_event(new new_child_event(this));
+		const std::shared_ptr<new_child_event> child_event(new new_child_event(this));
 		this->parent_view->schedule_update(child_event);
-		delete child_event;
+		if (child_event->unique()) {
+			child_event->reset(); // Delete the object if it wasn't stored elsewhere
+		}
 	}
 }
 
-- 
GitLab