Skip to content

Commit

Permalink
fix crashas
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Jul 20, 2024
1 parent 70e4670 commit 8aff971
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/protocols/core/Compositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,10 @@ void CWLSurfaceResource::commitPendingState() {
if (previousBuffer && !previousBuffer->isSynchronous() && !bufferReleased) {
if (previousBuffer->lockedByBackend) {
previousBuffer->hlEvents.backendRelease = previousBuffer->events.backendRelease.registerListener([this, previousBuffer](std::any data) {
previousBuffer->sendReleaseWithSurface(self.lock());
if (!self.expired()) // could be dead in the dtor
previousBuffer->sendReleaseWithSurface(self.lock());
else
previousBuffer->sendRelease();
previousBuffer->hlEvents.backendRelease.reset();
bufferReleased = true;
});
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/types/WLBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void CWLBufferResource::sendRelease() {
void CWLBufferResource::sendReleaseWithSurface(SP<CWLSurfaceResource> surf) {
sendRelease();

if (!surf->syncobj)
if (!surf || !surf->syncobj)
return;

if (drmSyncobjTimelineSignal(g_pCompositor->m_iDRMFD, &surf->syncobj->releaseTimeline->timeline->handle, &surf->syncobj->releasePoint, 1))
Expand Down
5 changes: 5 additions & 0 deletions src/render/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2622,6 +2622,11 @@ bool CHyprRenderer::beginRender(CMonitor* pMonitor, CRegion& damage, eRenderMode
return false;
}

if (!m_pCurrentRenderbuffer) {
Debug::log(ERR, "failed to start a render pass for output {}, no RBO could be obtained", pMonitor->szName);
return false;
}

if (mode == RENDER_MODE_NORMAL) {
damage = pMonitor->damage.getBufferDamage(HL_BUFFER_AGE);
pMonitor->damage.rotate();
Expand Down

0 comments on commit 8aff971

Please sign in to comment.