From 4c000cc03c8d1904828f9fdc9eef65870fe540fc Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Tue, 16 May 2023 02:16:12 -0700 Subject: [PATCH] Fix UB when removing nodes with faulty operator== --- src/Hy3Layout.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp index 5259e7f..68e04a8 100644 --- a/src/Hy3Layout.cpp +++ b/src/Hy3Layout.cpp @@ -98,15 +98,7 @@ Hy3NodeData& Hy3NodeData::operator=(Hy3GroupLayout layout) { } bool Hy3NodeData::operator==(const Hy3NodeData& rhs) const { - if (this->type != rhs.type) return false; - switch (this->type) { - case Hy3NodeData::Window: - return this->as_window == rhs.as_window; - case Hy3NodeData::Group: - return this->as_group.children == rhs.as_group.children; - } - - return false; + return this == &rhs; } bool Hy3Node::operator==(const Hy3Node& rhs) const {