diff options
author | Florian Haenel <florian.haenel@basyskom.com> | 2012-12-03 06:46:29 -0800 |
---|---|---|
committer | Florian Haenel <florian.haenel@basyskom.com> | 2012-12-03 07:11:44 -0800 |
commit | 95ffeba7ef4c0294fce7b04a3a6250f05f9876d0 (patch) | |
tree | fb36d0e176144318f804b1833ba2b6426140968e | |
parent | c2651cb953c4dfcf1578a380e65d6a0ec20ca571 (diff) | |
download | qtwayland-master.tar.gz |
Disambiguate multiple QWaylandBuffer pointersmaster
We carry multiple pointers to the same QWaylandBuffer object and when it
gets destroyed in a subclass, we still try to access the same object
from the superclass. Fixing this by removing the pointer from the
subclasses.
Also, to my understanding, we should signal the destruction to wayland by
a wl_destroy_buffer call from the client.
Change-Id: I67623e24452e92e9a4a0498b9b0b73d5b1b06c3a
6 files changed, 14 insertions, 13 deletions
diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp index 17dd6605..aeb9705c 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp @@ -57,7 +57,6 @@ QWaylandXCompositeEGLWindow::QWaylandXCompositeEGLWindow(QWindow *window, QWayla : QWaylandWindow(window) , m_glxIntegration(glxIntegration) , m_context(0) - , m_buffer(0) , m_xWindow(0) , m_config(q_configFromGLFormat(glxIntegration->eglDisplay(), window->format(), true, EGL_WINDOW_BIT | EGL_PIXMAP_BIT)) , m_surface(0) @@ -96,7 +95,8 @@ void QWaylandXCompositeEGLWindow::createEglSurface() size = QSize(1,1); } - delete m_buffer; + delete mBuffer; + mBuffer = 0; //XFreePixmap deletes the glxPixmap as well if (m_xWindow) { XDestroyWindow(m_glxIntegration->xDisplay(), m_xWindow); @@ -128,10 +128,10 @@ void QWaylandXCompositeEGLWindow::createEglSurface() } XSync(m_glxIntegration->xDisplay(),False); - m_buffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(), + mBuffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(), (uint32_t)m_xWindow, size); - attach(m_buffer); + attach(mBuffer); m_waitingForSync = true; struct wl_callback *callback = wl_display_sync(m_glxIntegration->waylandDisplay()->wl_display()); diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h index ac7419a9..7c9d8fa7 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h @@ -64,7 +64,6 @@ private: QWaylandXCompositeEGLIntegration *m_glxIntegration; QWaylandXCompositeEGLContext *m_context; - QWaylandBuffer *m_buffer; Window m_xWindow; EGLConfig m_config; diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp index 98d2e26b..e48f585c 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp @@ -54,7 +54,6 @@ QWaylandXCompositeGLXWindow::QWaylandXCompositeGLXWindow(QWindow *window, QWayla , m_glxIntegration(glxIntegration) , m_xWindow(0) , m_config(qglx_findConfig(glxIntegration->xDisplay(), glxIntegration->screen(), window->format(), GLX_WINDOW_BIT | GLX_PIXMAP_BIT)) - , m_buffer(0) , m_syncCallback(0) { } @@ -70,8 +69,8 @@ void QWaylandXCompositeGLXWindow::setGeometry(const QRect &rect) QWaylandWindow::setGeometry(rect); if (m_xWindow) { - delete m_buffer; - + delete mBuffer; + mBuffer = 0; XDestroyWindow(m_glxIntegration->xDisplay(), m_xWindow); m_xWindow = 0; } @@ -130,10 +129,10 @@ void QWaylandXCompositeGLXWindow::createSurface() XMapWindow(m_glxIntegration->xDisplay(), m_xWindow); XSync(m_glxIntegration->xDisplay(), False); - m_buffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(), + mBuffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(), (uint32_t)m_xWindow, size); - attach(m_buffer); + attach(mBuffer); waitForSync(); } diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h index 6c19ee49..31b3f634 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h @@ -68,8 +68,6 @@ private: Window m_xWindow; GLXFBConfig m_config; - QWaylandBuffer *m_buffer; - void waitForSync(); wl_callback *m_syncCallback; diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp index e14b6f53..8a87d5f1 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp @@ -57,3 +57,8 @@ QSize QWaylandXCompositeBuffer::size() const { return mSize; } + +QWaylandXCompositeBuffer::~QWaylandXCompositeBuffer() +{ + wl_buffer_destroy(mBuffer); +} diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.h index 5a0133d9..239b4f05 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.h @@ -54,7 +54,7 @@ public: QWaylandXCompositeBuffer(struct wl_xcomposite *xcomposite, uint32_t window, const QSize &size); - + ~QWaylandXCompositeBuffer(); QSize size() const; private: QSize mSize; |