Blame 0011-Revert-view-backend-exportable-private-Move-ViewBack.patch

Michael Catanzaro 1decafb
From 862764947c6a62e27371d0b31660ff41cd70b674 Mon Sep 17 00:00:00 2001
Michael Catanzaro 1decafb
From: Adrian Perez de Castro <aperez@igalia.com>
Michael Catanzaro 1decafb
Date: Sat, 10 Apr 2021 18:29:13 +0300
Michael Catanzaro 1decafb
Subject: [PATCH 11/13] Revert "view-backend-exportable-private: Move
Michael Catanzaro 1decafb
 ViewBackend::m_destroyClientListener"
Michael Catanzaro 1decafb
Michael Catanzaro 1decafb
This reverts commit d7577891d505a3fb037ec14e54568fe59e310941.
Michael Catanzaro 1decafb
---
Michael Catanzaro 1decafb
 src/view-backend-private.cpp | 14 +++++++-------
Michael Catanzaro 1decafb
 src/view-backend-private.h   |  6 +-----
Michael Catanzaro 1decafb
 2 files changed, 8 insertions(+), 12 deletions(-)
Michael Catanzaro 1decafb
Michael Catanzaro 1decafb
diff --git a/src/view-backend-private.cpp b/src/view-backend-private.cpp
Michael Catanzaro 1decafb
index 6ba3fcb..af5472f 100644
Michael Catanzaro 1decafb
--- a/src/view-backend-private.cpp
Michael Catanzaro 1decafb
+++ b/src/view-backend-private.cpp
Michael Catanzaro 1decafb
@@ -112,16 +112,16 @@ void ViewBackend::registerSurface(uint32_t bridgeId)
Michael Catanzaro 1decafb
     m_bridgeId = bridgeId;
Michael Catanzaro 1decafb
     m_client = WS::Instance::singleton().registerViewBackend(m_bridgeId, *this);
Michael Catanzaro 1decafb
 
Michael Catanzaro 1decafb
-    struct wl_client_destroy_listener *listener = new wl_client_destroy_listener {this, };
Michael Catanzaro 1decafb
-    listener->destroyClientListener.notify = (wl_notify_func_t) [](struct wl_listener* listener, void* data)
Michael Catanzaro 1decafb
+    this->m_destroyClientListener.notify = (wl_notify_func_t) [](struct wl_listener* listener, void* data)
Michael Catanzaro 1decafb
     {
Michael Catanzaro 1decafb
-        struct wl_client_destroy_listener *container;
Michael Catanzaro 1decafb
-        container = wl_container_of(listener, container, destroyClientListener);
Michael Catanzaro 1decafb
-        container->backend->m_client = NULL;
Michael Catanzaro 1decafb
-        delete container;  // Release the wl_client_destroy_listener instance since this is not longer needed.
Michael Catanzaro 1decafb
+        ViewBackend *viewBackend = wl_container_of(listener, viewBackend, m_destroyClientListener);
Michael Catanzaro 1decafb
+
Michael Catanzaro 1decafb
+        struct wl_client* client = (struct wl_client*) data;
Michael Catanzaro 1decafb
+        g_debug("ViewBackend <%p>: wl_client <%p> destroy notification for fd %d", viewBackend, data, wl_client_get_fd(client));
Michael Catanzaro 1decafb
+        viewBackend->m_client = NULL;
Michael Catanzaro 1decafb
     };
Michael Catanzaro 1decafb
     wl_client_add_destroy_listener(m_client,
Michael Catanzaro 1decafb
-                                   &listener->destroyClientListener);
Michael Catanzaro 1decafb
+                                   &this->m_destroyClientListener);
Michael Catanzaro 1decafb
 }
Michael Catanzaro 1decafb
 
Michael Catanzaro 1decafb
 void ViewBackend::unregisterSurface(uint32_t bridgeId)
Michael Catanzaro 1decafb
diff --git a/src/view-backend-private.h b/src/view-backend-private.h
Michael Catanzaro 1decafb
index 81b083c..599382b 100644
Michael Catanzaro 1decafb
--- a/src/view-backend-private.h
Michael Catanzaro 1decafb
+++ b/src/view-backend-private.h
Michael Catanzaro 1decafb
@@ -86,11 +86,7 @@ private:
Michael Catanzaro 1decafb
 
Michael Catanzaro 1decafb
     std::unique_ptr<FdoIPC::Connection> m_socket;
Michael Catanzaro 1decafb
     int m_clientFd { -1 };
Michael Catanzaro 1decafb
-};
Michael Catanzaro 1decafb
-
Michael Catanzaro 1decafb
-struct wl_client_destroy_listener {
Michael Catanzaro 1decafb
-    ViewBackend* backend;
Michael Catanzaro 1decafb
-    struct wl_listener destroyClientListener;
Michael Catanzaro 1decafb
+    struct wl_listener m_destroyClientListener;
Michael Catanzaro 1decafb
 };
Michael Catanzaro 1decafb
 
Michael Catanzaro 1decafb
 struct wpe_view_backend_private {
Michael Catanzaro 1decafb
-- 
Michael Catanzaro 1decafb
2.31.1
Michael Catanzaro 1decafb