Diff
1diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
2index a7eab18a26a7700a02ff963c1a02b1724e1cf036..5889d18fa6426bc8efbf6ec26c53507068db9276 100644
3--- a/src/Hy3Layout.cpp
4+++ b/src/Hy3Layout.cpp
5@@ -3,6 +3,16 @@
6 #include "SelectionHook.hpp"
7
8 #include <hyprland/src/Compositor.hpp>
9+#include <hyprland/src/plugins/PluginAPI.hpp>
10+
11+void errorNotif() {
12+ HyprlandAPI::addNotificationV2(PHANDLE, {
13+ {"text", "Something has gone very wrong. Check the log for details."},
14+ {"time", (uint64_t)10000},
15+ {"color", CColor(1.0, 0.0, 0.0, 1.0)},
16+ {"icon", ICON_ERROR},
17+ });
18+}
19
20 Hy3GroupData::Hy3GroupData(Hy3GroupLayout layout): layout(layout) {}
21
22@@ -116,6 +126,7 @@ void Hy3Node::recalcSizePosRecursive(bool force) {
23
24 if (child == this) {
25 Debug::log(ERR, "a group (%p) has become its own child", this);
26+ errorNotif();
27 }
28
29 double distortOut;
30@@ -300,7 +311,11 @@ Hy3Node* Hy3Node::removeFromParentRecursive() {
31 }
32 }
33
34- group.children.remove(child);
35+ if (!group.children.remove(child)) {
36+ Debug::log(ERR, "Was unable to remove child node %p from parent %p. Child likely has a false parent pointer.", child, parent);
37+ errorNotif();
38+ return nullptr;
39+ }
40
41 if (group.children.size() == 1) {
42 group.lastFocusedChild = group.children.front();
43@@ -417,6 +432,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool force) {
44
45 if (monitor == nullptr) {
46 Debug::log(ERR, "Orphaned Node %x (workspace ID: %i)!!", node, node->workspace_id);
47+ errorNotif();
48 return;
49 }
50
51@@ -433,6 +449,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool force) {
52
53 if (!g_pCompositor->windowExists(window) || !window->m_bIsMapped) {
54 Debug::log(ERR, "Node %p holding invalid window %p!!", node, window);
55+ errorNotif();
56 this->onWindowRemovedTiling(window);
57 return;
58 }
59@@ -547,6 +564,7 @@ void Hy3Layout::onWindowCreatedTiling(CWindow* window) {
60
61 if (opening_into->data.type != Hy3NodeData::Group) {
62 Debug::log(ERR, "opening_into node %p was not of type Group", opening_into);
63+ errorNotif();
64 return;
65 }
66