4c000cc03c8d1904828f9fdc9eef65870fe540fc

Author
outfoxxed <outfoxxed@outfoxxed.me>
Committer
outfoxxed <outfoxxed@outfoxxed.me>
Date

Message

Fix UB when removing nodes with faulty operator==

Diff

 1diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
 2index 5259e7f526aa047b07dc9c898e4cd315b99bbbcc..68e04a816e7866d9b91eaad732c60cc63a1ac7a8 100644
 3--- a/src/Hy3Layout.cpp
 4+++ b/src/Hy3Layout.cpp
 5@@ -98,15 +98,7 @@ Hy3NodeData& Hy3NodeData::operator=(Hy3GroupLayout layout) {
 6 }
 7 
 8 bool Hy3NodeData::operator==(const Hy3NodeData& rhs) const {
 9-	if (this->type != rhs.type) return false;
10-	switch (this->type) {
11-	case Hy3NodeData::Window:
12-		return this->as_window == rhs.as_window;
13-	case Hy3NodeData::Group:
14-		return this->as_group.children == rhs.as_group.children;
15-	}
16-
17-	return false;
18+	return this == &rhs;
19 }
20 
21 bool Hy3Node::operator==(const Hy3Node& rhs) const {