image-copy: Raise the duplicate_frame protocol error - #2185
Merged
Merged
Conversation
Netflate
force-pushed
the
fix/image-copy-duplicate-frame
branch
from
September 28, 2026 16:04
0fcd367 to
4cdf1e9
Compare
Drakulix
reviewed
Sep 29, 2026
Drakulix
left a comment
Member
There was a problem hiding this comment.
thanks for tackling this, couple of comments
| .unwrap() | ||
| .active_frames | ||
| .push(FrameRef { obj, inner }); | ||
| if !self.inner.lock().unwrap().active_frames.is_empty() { |
Member
There was a problem hiding this comment.
well, if only one frame can exist at a time, active_frames should be changed to an Option called active_frame.
Author
There was a problem hiding this comment.
done
re-tested to be sure, behavior is unchanged. The first create_frame is accepted and the second one raises the error
| ext_image_copy_capture_session_v1::Error::DuplicateFrame, | ||
| "create_frame sent before the previous frame was destroyed", | ||
| ); | ||
| } else { |
Member
There was a problem hiding this comment.
Please just add a return to the if branch and remove the else. We can avoid the indentation here.
| .unwrap() | ||
| .active_frames | ||
| .push(FrameRef { obj, inner }); | ||
| if !self.inner.lock().unwrap().active_frames.is_empty() { |
`create_frame` should not create an active frame when one already exists. `ext_image_copy_capture_session_v1` defines an error for this (`duplicate_frame`) but it is never raised. Refuse to create a second frame while the session still has an active one. Signed-off-by: Netflate <netflate@gmail.com>
Netflate
force-pushed
the
fix/image-copy-duplicate-frame
branch
from
September 29, 2026 20:49
4cdf1e9 to
745b774
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
create_frameshould not create an active frame when one already exists.ext_image_copy_capture_session_v1already defines an error for this (duplicate_frame) but it was never raised.Refuse to create a second frame while session still has an active one. Checking if
active_framesis empty or not is accurate since the frame'sdestroyed()already removes it from the session.From the protocol:
Tested with an
ext-image-copy-captureclient that callscreate_frametwice without destroying the first one:Before, the second request is accepted silently:
After:
(Reported downstream in pop-os/cosmic-comp#2279.)
Checklist