[GTK] Fix PlatformDisplayWayland construction error, implement the destructor
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 May 2015 07:05:47 +0000 (07:05 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 May 2015 07:05:47 +0000 (07:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144997

Reviewed by Carlos Garcia Campos.

The PlatformDisplayWayland constructor is private, so we can't use
std::make_unique<>() to construct an object of this class.

Implement the PlatformDisplayWayland destructor, cleaning out all
the Wayland resources, if present.

* platform/graphics/wayland/PlatformDisplayWayland.cpp:
(WebCore::PlatformDisplayWayland::create):
(WebCore::PlatformDisplayWayland::PlatformDisplayWayland):
(WebCore::PlatformDisplayWayland::~PlatformDisplayWayland):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184374 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp

index cbabe8c1390003054b4f522912dfab70f5e6cde1..23b38fb82088cae5762b86223143490933f10b0f 100644 (file)
@@ -1,3 +1,21 @@
+2015-05-15  Zan Dobersek  <zdobersek@igalia.com>
+
+        [GTK] Fix PlatformDisplayWayland construction error, implement the destructor
+        https://bugs.webkit.org/show_bug.cgi?id=144997
+
+        Reviewed by Carlos Garcia Campos.
+
+        The PlatformDisplayWayland constructor is private, so we can't use
+        std::make_unique<>() to construct an object of this class.
+
+        Implement the PlatformDisplayWayland destructor, cleaning out all
+        the Wayland resources, if present.
+
+        * platform/graphics/wayland/PlatformDisplayWayland.cpp:
+        (WebCore::PlatformDisplayWayland::create):
+        (WebCore::PlatformDisplayWayland::PlatformDisplayWayland):
+        (WebCore::PlatformDisplayWayland::~PlatformDisplayWayland):
+
 2015-05-14  Zalan Bujtas  <zalan@apple.com>
 
         Images on www.fitstylelife.com jiggle on hover.
index ccbc35f13e93b81bd99808c8d3405e9b576d18c7..888b2535042c2bc4addde013d4fcfdc7274b31fa 100644 (file)
@@ -61,11 +61,11 @@ std::unique_ptr<PlatformDisplayWayland> PlatformDisplayWayland::create()
     if (!wlDisplay)
         return nullptr;
 
-    auto display = std::make_unique<PlatformDisplayWayland>(wlDisplay);
+    auto display = std::unique_ptr<PlatformDisplayWayland>(new PlatformDisplayWayland(wlDisplay));
     if (!display->isInitialized())
         return nullptr;
 
-    return WTF::move(display);
+    return display;
 }
 
 PlatformDisplayWayland::PlatformDisplayWayland(struct wl_display* wlDisplay)
@@ -100,6 +100,18 @@ PlatformDisplayWayland::PlatformDisplayWayland(struct wl_display* wlDisplay)
     m_eglConfigChosen = true;
 }
 
+PlatformDisplayWayland::~PlatformDisplayWayland()
+{
+    if (m_webkitgtk)
+        wl_webkitgtk_destroy(m_webkitgtk);
+    if (m_compositor)
+        wl_compositor_destroy(m_compositor);
+    if (m_registry)
+        wl_registry_destroy(m_registry);
+    if (m_display)
+        wl_display_disconnect(m_display);
+}
+
 std::unique_ptr<WaylandSurface> PlatformDisplayWayland::createSurface(const IntSize& size, int widgetId)
 {
     struct wl_surface* wlSurface = wl_compositor_create_surface(m_compositor);