scoped_wl.cc 842 B

123456789101112131415161718192021222324252627
  1. // Copyright 2015 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "components/exo/wayland/scoped_wl.h"
  5. #include <wayland-server-core.h>
  6. namespace exo {
  7. namespace wayland {
  8. void WlDisplayDeleter::operator()(wl_display* display) const {
  9. // Destroy all clients in the display manually, because wl_display_destroy()
  10. // doesn't do it.
  11. // TODO(penghuang): Remove below manual client tear down code if the
  12. // wl_display_destroy() is fixed upstream.
  13. wl_list* client_list = wl_display_get_client_list(display);
  14. while (!wl_list_empty(client_list)) {
  15. wl_client* client = wl_client_from_link(client_list->next);
  16. wl_client_destroy(client);
  17. }
  18. wl_display_destroy(display);
  19. }
  20. } // namespace wayland
  21. } // namespace exo