mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-01 20:51:58 -07:00
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
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#include "DRMLease.hpp"
|
#include "DRMLease.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
|
#include "managers/eventLoop/EventLoopManager.hpp"
|
||||||
#include <aquamarine/backend/DRM.hpp>
|
#include <aquamarine/backend/DRM.hpp>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
@@ -225,7 +226,7 @@ CDRMLeaseDevice::CDRMLeaseDevice(SP<Aquamarine::CDRMBackend> drmBackend) : backe
|
|||||||
auto fd = drm->getNonMasterFD();
|
auto fd = drm->getNonMasterFD();
|
||||||
|
|
||||||
if (fd < 0) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,10 +248,8 @@ CDRMLeaseProtocol::CDRMLeaseProtocol(const wl_interface* iface, const int& ver,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!primaryDevice || primaryDevice->success) {
|
if (!primaryDevice || !primaryDevice->success)
|
||||||
PROTO::lease.reset();
|
g_pEventLoopManager->doLater([]() { PROTO::lease.reset(); });
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDRMLeaseProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
void CDRMLeaseProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
||||||
|
Reference in New Issue
Block a user