wayland: display unique_ptr holds a void(*)(...) deleter
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>
Mon, 26 Jun 2017 11:20:05 +0000 (13:20 +0200)
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>
Tue, 8 Aug 2017 15:24:00 +0000 (17:24 +0200)
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
src/wayland.cpp
src/wayland.hpp

index 2bae9e8..950335a 100644 (file)
@@ -15,14 +15,18 @@ namespace wl {
 //  \__,_|_|___/ .__/|_|\__,_|\__, |
 //             |_|            |___/
 display::display()
-   : d(std::unique_ptr<struct wl_display,
-                       std::function<void(struct wl_display *)>>(
+   : d(std::unique_ptr<struct wl_display, void (*)(struct wl_display *)>(
         wl_display_connect(NULL),
+#ifdef DEBUG_OUTPUT
         [](struct wl_display *d) {
            logdebug("wl::display ~display @ %p", d);
            wl_display_disconnect(d);
         })),
-     r(d.get()) {}
+#else
+        &wl_display_disconnect)),
+#endif
+     r(d.get()) {
+}
 
 display::~display() {}
 
index ba1effd..7ff1145 100644 (file)
@@ -66,8 +66,7 @@ struct registry : public wayland_proxy<struct wl_registry> {
 //  \__,_|_|___/ .__/|_|\__,_|\__, |
 //             |_|            |___/
 struct display {
-   std::unique_ptr<struct wl_display, std::function<void(struct wl_display *)>>
-      d;
+   std::unique_ptr<struct wl_display, void(*)(struct wl_display *)> d;
    struct registry r;
 
    display();