summaryrefslogtreecommitdiff
path: root/src/protocols/DRMLease.cpp
diff options
context:
space:
mode:
authorTom Englund <tomenglund26@gmail.com>2024-08-12 20:49:52 +0200
committerGitHub <noreply@github.com>2024-08-12 19:49:52 +0100
commit77cf651825c2afac69e3a827ff910a62c73e1218 (patch)
treed7d0881cbdc0bab4154e075e3ab1466255a0bedc /src/protocols/DRMLease.cpp
parentc7b72790bd63172f04ee86784d4cb2a400532927 (diff)
protocols: avoid crashing in drmlease (#7290)
instead of potentially causing wonky behaviour from destructing in the constructor add the unique_ptr reset to doLater and dont use the not done constructed protolog in the constructor, call Debug::log directly. see issue #7240
Diffstat (limited to 'src/protocols/DRMLease.cpp')
-rw-r--r--src/protocols/DRMLease.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/protocols/DRMLease.cpp b/src/protocols/DRMLease.cpp
index 9f5b6312..3ab38ea1 100644
--- a/src/protocols/DRMLease.cpp
+++ b/src/protocols/DRMLease.cpp
@@ -1,5 +1,6 @@
#include "DRMLease.hpp"
#include "../Compositor.hpp"
+#include "managers/eventLoop/EventLoopManager.hpp"
#include <aquamarine/backend/DRM.hpp>
#include <fcntl.h>
@@ -225,7 +226,7 @@ CDRMLeaseDevice::CDRMLeaseDevice(SP<Aquamarine::CDRMBackend> drmBackend) : backe
auto fd = drm->getNonMasterFD();
if (fd < 0) {
- LOGM(ERR, "Failed to dup fd for drm node {}", drm->gpuName);
+ Debug::log(ERR, "[DRMLease] Failed to dup fd for drm node {}", drm->gpuName);
return;
}
@@ -247,10 +248,8 @@ CDRMLeaseProtocol::CDRMLeaseProtocol(const wl_interface* iface, const int& ver,
break;
}
- if (!primaryDevice || primaryDevice->success) {
- PROTO::lease.reset();
- return;
- }
+ if (!primaryDevice || !primaryDevice->success)
+ g_pEventLoopManager->doLater([]() { PROTO::lease.reset(); });
}
void CDRMLeaseProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {