From db48f973fd436a38dfd5ed63991610bb90b30bc9 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 5 Sep 2023 13:33:04 +0200 Subject: [PATCH] xdgoutput: do not destroy resources on monitorRemoved --- src/protocols/XDGOutput.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/protocols/XDGOutput.cpp b/src/protocols/XDGOutput.cpp index 4a7278d40..94839e20f 100644 --- a/src/protocols/XDGOutput.cpp +++ b/src/protocols/XDGOutput.cpp @@ -62,7 +62,12 @@ CXDGOutputProtocol::CXDGOutputProtocol(const wl_interface* iface, const int& ver g_pHookSystem->hookDynamic("configReloaded", [this](void* self, std::any param) { this->updateAllOutputs(); }); g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, std::any param) { const auto PMONITOR = std::any_cast(param); - std::erase_if(m_vXDGOutputs, [&](const auto& other) { return other->monitor == PMONITOR; }); + std::erase_if(m_vXDGOutputs, [&](const auto& other) { + const auto REMOVE = other->monitor == PMONITOR; + if (REMOVE) + other->resource->markDefunct(); // so that wl_resource_destroy is not sent + return REMOVE; + }); }); }