gammactrl: guard pMonitor in setGamma

This commit is contained in:
Vaxry 2024-10-09 22:00:06 +01:00
parent 6ae89940c7
commit c4eb194033

View file

@ -46,6 +46,13 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
resource->setOnDestroy([this](CZwlrGammaControlV1* gamma) { PROTO::gamma->destroyGammaControl(this); }); resource->setOnDestroy([this](CZwlrGammaControlV1* gamma) { PROTO::gamma->destroyGammaControl(this); });
resource->setSetGamma([this](CZwlrGammaControlV1* gamma, int32_t fd) { resource->setSetGamma([this](CZwlrGammaControlV1* gamma, int32_t fd) {
if (!pMonitor) {
LOGM(ERR, "setGamma for a dead monitor");
resource->sendFailed();
close(fd);
return;
}
LOGM(LOG, "setGamma for {}", pMonitor->szName); LOGM(LOG, "setGamma for {}", pMonitor->szName);
int fdFlags = fcntl(fd, F_GETFL, 0); int fdFlags = fcntl(fd, F_GETFL, 0);