mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 16:05:58 +01: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:
parent
c7b72790bd
commit
77cf651825
1 changed files with 4 additions and 5 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue