Fix bad file descriptor when using wlgrab

This commit is contained in:
Loki
2021-09-05 11:16:59 +02:00
parent 7fbe9ba34f
commit b072af3082
3 changed files with 5 additions and 15 deletions
+2 -10
View File
@@ -169,9 +169,6 @@ void dmabuf_t::frame(
next_frame->sd.height = height; next_frame->sd.height = height;
next_frame->sd.modifier = (((std::uint64_t)high) << 32) | low; next_frame->sd.modifier = (((std::uint64_t)high) << 32) | low;
next_frame->sd.obj_count = obj_count; 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( void dmabuf_t::object(
@@ -215,15 +212,10 @@ void dmabuf_t::cancel(
} }
void frame_t::destroy() { void frame_t::destroy() {
if(!close_fds) { for(auto x = 0; x < sd.obj_count; ++x) {
return;
}
for(auto x = 0; x < 4; ++x) {
if(sd.fds[x] >= 0) {
close(sd.fds[x]); close(sd.fds[x]);
} }
} sd.obj_count = 0;
close_fds = false;
} }
std::vector<std::unique_ptr<monitor_t>> monitors(const char *display_name) { std::vector<std::unique_ptr<monitor_t>> monitors(const char *display_name) {
-2
View File
@@ -23,8 +23,6 @@ class frame_t {
public: public:
egl::surface_descriptor_t sd; egl::surface_descriptor_t sd;
bool close_fds = false;
void destroy(); void destroy();
}; };
+1 -1
View File
@@ -263,7 +263,7 @@ public:
img->sd = current_frame->sd; img->sd = current_frame->sd;
// Prevent dmabuf from closing the file descriptors. // Prevent dmabuf from closing the file descriptors.
current_frame->close_fds = false; current_frame->sd.obj_count = 0;
return platf::capture_e::ok; return platf::capture_e::ok;
} }