wayland: minor fix with this-> and formatting
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>
Mon, 19 Jun 2017 11:52:10 +0000 (13:52 +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 c19b0dc..b4f4800 100644 (file)
@@ -53,8 +53,9 @@ constexpr struct wl_registry_listener registry_listener = {
 }
 
 registry::registry(struct wl_display *d)
-   : wayland_proxy(wl_display_get_registry(d)) {
-   wl_registry_add_listener(this->proxy, &registry_listener, this);
+   : wayland_proxy(!d ? nullptr : wl_display_get_registry(d)) {
+   if (this->proxy)
+      wl_registry_add_listener(this->proxy, &registry_listener, this);
 }
 
 registry::~registry() {
index c97c51a..afebe92 100644 (file)
@@ -27,7 +27,7 @@ struct wayland_proxy {
       // custom wayland dtor
       if (this->proxy) {
          logdebug("%s %p @ %p", __func__, this, this->proxy);
-         wl_proxy_destroy(reinterpret_cast<struct wl_proxy *>(proxy));
+         wl_proxy_destroy(reinterpret_cast<struct wl_proxy *>(this->proxy));
       }
    }
 };