summaryrefslogtreecommitdiff
path: root/dev-qt/qtwebengine/files/qtwebengine-6.9.0-x11-pixmap-leak.patch
blob: 17071b0c7354f6ac195f3b4e4d47c8aec9739141 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Patch status: fixed in Qt 6.9.1

https://bugreports.qt.io/browse/QTBUG-135047
https://codereview.qt-project.org/c/qt/qtwebengine/+/634033
--- a/src/core/compositor/native_skia_output_device_opengl.cpp
+++ b/src/core/compositor/native_skia_output_device_opengl.cpp
@@ -214,9 +214,10 @@
             glFun->glBindTexture(GL_TEXTURE_2D, 0);
 
-            m_frontBuffer->textureCleanupCallback = [glFun, glxFun, display, glxPixmap,
-                                                     glTexture]() {
+            m_frontBuffer->textureCleanupCallback = [glFun, glxFun, display, glxPixmap, glTexture,
+                                                     glxHelper, pixmapId]() {
                 glxFun->glXReleaseTexImageEXT(display, glxPixmap, GLX_FRONT_LEFT_EXT);
                 glFun->glDeleteTextures(1, &glTexture);
                 glXDestroyGLXPixmap(display, glxPixmap);
+                glxHelper->freePixmap(pixmapId);
             };
         }
--- a/src/core/ozone/glx_helper.cpp
+++ b/src/core/ozone/glx_helper.cpp
@@ -101,3 +101,13 @@
 }
 
+void GLXHelper::freePixmap(uint32_t pixmapId) const
+{
+    xcb_void_cookie_t cookie = xcb_free_pixmap_checked(m_connection, pixmapId);
+    xcb_generic_error_t *error = xcb_request_check(m_connection, cookie);
+    if (error) {
+        qWarning("GLX: XCB_FREE_PIXMAP failed with error code: 0x%x", error->error_code);
+        free(error);
+    }
+}
+
 QT_END_NAMESPACE
--- a/src/core/ozone/glx_helper.h
+++ b/src/core/ozone/glx_helper.h
@@ -34,4 +34,5 @@
     GLXPixmap importBufferAsPixmap(int dmaBufFd, uint32_t size, uint16_t width, uint16_t height,
                                    uint16_t stride) const;
+    void freePixmap(uint32_t pixmapId) const;
     bool isDmaBufSupported() const { return m_isDmaBufSupported; }