fixed ASSERT and last commit's oopsie

This commit is contained in:
vaxerski 2022-03-27 22:34:02 +02:00
parent de8d2fd136
commit 144a79ee00
3 changed files with 19 additions and 3 deletions

View File

@ -26,6 +26,10 @@
#define HYPRATOM(name) {name, 0}
#define RASSERT(expr, reason) if (expr) { Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n%s\n\nat: line %s in %s", reason, __LINE__, __FILE__); RIP("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info.");}
#define RASSERT(expr, reason) \
if (!expr) { \
Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n%s\n\nat: line %d in %s", std::string(reason).c_str(), __LINE__, ([]() constexpr->std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })().c_str()); \
RIP("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info."); \
}
#define ASSERT(expr) RASSERT(expr, "?")

View File

@ -141,7 +141,9 @@ void Events::listener_unmapWindow(wl_listener* listener, void* data) {
// refocus on a new window
g_pInputManager->refocus();
SubsurfaceTree::destroySurfaceTree(PWINDOW->m_pSurfaceTree);
PWINDOW->m_pSurfaceTree = nullptr;
}
@ -250,4 +252,4 @@ void Events::listener_newXDGSurface(wl_listener* listener, void* data) {
wl_signal_add(&XDGSURFACE->toplevel->events.set_title, &PNEWWINDOW->listen_setTitleWindow);
wl_signal_add(&XDGSURFACE->toplevel->events.request_fullscreen, &PNEWWINDOW->listen_fullscreenWindow);
wl_signal_add(&XDGSURFACE->events.new_popup, &PNEWWINDOW->listen_newPopupXDG);
}
}

View File

@ -56,6 +56,16 @@ SSurfaceTreeNode* SubsurfaceTree::createTreeRoot(wlr_surface* pSurface, applyGlo
void destroySubsurface(SSubsurface* pSubsurface);
void SubsurfaceTree::destroySurfaceTree(SSurfaceTreeNode* pNode) {
bool exists = false;
for (auto& n : surfaceTreeNodes) {
if (&n == pNode) {
exists = true;
break;
}
}
RASSERT(exists, "Tried to delete a surfaceTreeNode that doesn't exist!");
for (auto& c : pNode->childSubsurfaces)
destroySubsurface(&c);
@ -160,4 +170,4 @@ void Events::listener_destroySubsurfaceNode(wl_listener* listener, void* data) {
wl_list_remove(&pNode->listen_destroy.link);
SubsurfaceTree::surfaceTreeNodes.remove(*pNode);
}
}