mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-02-28 12:40:33 +00:00
Fix bad file descriptor when using wlgrab
This commit is contained in:
parent
7fbe9ba34f
commit
b072af3082
@ -169,9 +169,6 @@ void dmabuf_t::frame(
|
||||
next_frame->sd.height = height;
|
||||
next_frame->sd.modifier = (((std::uint64_t)high) << 32) | low;
|
||||
next_frame->sd.obj_count = obj_count;
|
||||
|
||||
next_frame->close_fds = true;
|
||||
std::fill_n(next_frame->sd.fds + obj_count, 4 - obj_count, -1);
|
||||
}
|
||||
|
||||
void dmabuf_t::object(
|
||||
@ -215,15 +212,10 @@ void dmabuf_t::cancel(
|
||||
}
|
||||
|
||||
void frame_t::destroy() {
|
||||
if(!close_fds) {
|
||||
return;
|
||||
for(auto x = 0; x < sd.obj_count; ++x) {
|
||||
close(sd.fds[x]);
|
||||
}
|
||||
for(auto x = 0; x < 4; ++x) {
|
||||
if(sd.fds[x] >= 0) {
|
||||
close(sd.fds[x]);
|
||||
}
|
||||
}
|
||||
close_fds = false;
|
||||
sd.obj_count = 0;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<monitor_t>> monitors(const char *display_name) {
|
||||
|
@ -23,8 +23,6 @@ class frame_t {
|
||||
public:
|
||||
egl::surface_descriptor_t sd;
|
||||
|
||||
bool close_fds = false;
|
||||
|
||||
void destroy();
|
||||
};
|
||||
|
||||
|
@ -260,10 +260,10 @@ public:
|
||||
++sequence;
|
||||
img->sequence = sequence;
|
||||
|
||||
img->sd = current_frame->sd;
|
||||
img->sd = current_frame->sd;
|
||||
|
||||
// Prevent dmabuf from closing the file descriptors.
|
||||
current_frame->close_fds = false;
|
||||
current_frame->sd.obj_count = 0;
|
||||
|
||||
return platf::capture_e::ok;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user