Commit 1012541c authored by David Edmundson's avatar David Edmundson
Browse files

Don't use Qt::UniqueConnection on a lambda

It won't detect properly, instead the same code is moved into a member
function.


(cherry picked from commit 13d878d2)
parent 8ab52255
......@@ -313,20 +313,7 @@ void SurfaceInterfacePrivate::surface_attach(Resource *resource, struct ::wl_res
return;
}
pending.buffer = BufferInterface::get(compositor->display(), buffer);
QObject::connect(pending.buffer, &BufferInterface::aboutToBeDestroyed, q,
[this](BufferInterface *buffer) {
if (pending.buffer == buffer) {
pending.buffer = nullptr;
}
if (cached.buffer == buffer) {
cached.buffer = nullptr;
}
if (current.buffer == buffer) {
current.buffer->unref();
current.buffer = nullptr;
}
},
Qt::UniqueConnection);
QObject::connect(pending.buffer, &BufferInterface::aboutToBeDestroyed, q, &SurfaceInterface::handleBufferRemoved, Qt::UniqueConnection);
}
void SurfaceInterfacePrivate::surface_damage(Resource *, int32_t x, int32_t y, int32_t width, int32_t height)
......@@ -1016,4 +1003,18 @@ QMatrix4x4 SurfaceInterface::surfaceToBufferMatrix() const
return d->surfaceToBufferMatrix;
}
void SurfaceInterface::handleBufferRemoved(BufferInterface *buffer)
{
if (d->pending.buffer == buffer) {
d->pending.buffer = nullptr;
}
if (d->cached.buffer == buffer) {
d->cached.buffer = nullptr;
}
if (d->current.buffer == buffer) {
d->current.buffer->unref();
d->current.buffer = nullptr;
}
}
} // namespace KWaylandServer
......@@ -481,6 +481,8 @@ Q_SIGNALS:
void committed();
private:
void handleBufferRemoved(BufferInterface *buffer);
QScopedPointer<SurfaceInterfacePrivate> d;
friend class SurfaceInterfacePrivate;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment