From 801b800cd2baffa9d3080ec3184ffd1af6b9bde8 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 13 Apr 2012 11:57:22 +0300 Subject: [PATCH] Do not crash when closing pop-ups in widget apps. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The shm frame callback has to be destroyed otherwise the callback will occur after the dtor. Also, start using the previously unused 'window' variable in the callback. Change-Id: Iace09ae981344dcbe4112f49fcd19491963e4668 Reviewed-by: Jørgen Lind --- src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 0d4d06f..5858f24 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -135,6 +135,9 @@ QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window) QWaylandShmBackingStore::~QWaylandShmBackingStore() { + if (mFrameCallback) + wl_callback_destroy(mFrameCallback); + // if (mFrontBuffer == waylandWindow()->attached()) // waylandWindow()->attach(0); @@ -269,16 +272,16 @@ void QWaylandShmBackingStore::done(void *data, wl_callback *callback, uint32_t t QWaylandWindow *window = self->waylandWindow(); wl_callback_destroy(self->mFrameCallback); self->mFrameCallback = 0; - if (self->mFrontBuffer != self->waylandWindow()->attached()) { - delete self->waylandWindow()->attached(); - self->waylandWindow()->attach(self->mFrontBuffer); + if (self->mFrontBuffer != window->attached()) { + delete window->attached(); + window->attach(self->mFrontBuffer); } if (self->mFrontBufferIsDirty && !self->mPainting) { self->mFrontBufferIsDirty = false; - self->mFrameCallback = wl_surface_frame(self->waylandWindow()->wl_surface()); + self->mFrameCallback = wl_surface_frame(window->wl_surface()); wl_callback_add_listener(self->mFrameCallback,&self->frameCallbackListener,self); - self->waylandWindow()->damage(QRect(QPoint(0,0),self->mFrontBuffer->size())); + window->damage(QRect(QPoint(0,0),self->mFrontBuffer->size())); } } -- 2.7.4