wayland/screencopy: handle buffer creation failures

This commit is contained in:
outfoxxed 2025-07-26 00:48:21 -07:00
parent ab096b7e78
commit 91c9db581e
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
4 changed files with 30 additions and 0 deletions

View file

@ -111,6 +111,15 @@ void WlrScreencopyContext::zwlr_screencopy_frame_v1_flags(uint32_t flags) {
void WlrScreencopyContext::zwlr_screencopy_frame_v1_buffer_done() {
auto* backbuffer = this->mSwapchain.createBackbuffer(this->request);
if (!backbuffer || !backbuffer->buffer()) {
qCWarning(logScreencopy) << "Backbuffer creation failed for screencopy. Skipping frame.";
// Try again. This will be spammy if the compositor continuously sends bad frames.
this->destroy();
this->captureFrame();
return;
}
if (this->copiedFirstFrame) {
this->copy_with_damage(backbuffer->buffer());
} else {