Skip to content

Commit

Permalink
Don't sit in a loop if polling fails
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanGriffiths committed Nov 1, 2023
1 parent 5d6548e commit 2b23c88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/client/mir_shell_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class toplevel : public window
class grey_window : public toplevel
{
public:
grey_window(int32_t width, int32_t height, unsigned char intensity) : toplevel(width, height), intensity(intensity) {}
using toplevel::toplevel;

private:
Expand Down Expand Up @@ -575,7 +576,7 @@ class satellite : public grey_window
};

satellite::satellite(int32_t width, int32_t height, xdg_positioner* positioner, xdg_toplevel* parent) :
grey_window{width, height},
grey_window{width, height, 128},
mir_surface{globals::mir_shell ? zmir_mir_shell_v1_get_satellite_surface(globals::mir_shell, *this, positioner) : nullptr}
{
xdg_toplevel_set_parent(*this, parent);
Expand Down
2 changes: 2 additions & 0 deletions examples/client/wayland_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ void mir::client::WaylandRunner::operator()(wl_display* display)

if (poll(fds, indices, -1) == -1)
{
fprintf(stderr, "Failed to poll\n");
wl_display_cancel_read(display);
break;
}

if (fds[display_fd].revents & (POLLIN | POLLERR))
Expand Down

0 comments on commit 2b23c88

Please sign in to comment.