Commit 13d878d2 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.
parent bfc4dadd
...@@ -313,20 +313,7 @@ void SurfaceInterfacePrivate::surface_attach(Resource *resource, struct ::wl_res ...@@ -313,20 +313,7 @@ void SurfaceInterfacePrivate::surface_attach(Resource *resource, struct ::wl_res
return; return;
} }
pending.buffer = BufferInterface::get(compositor->display(), buffer); pending.buffer = BufferInterface::get(compositor->display(), buffer);
QObject::connect(pending.buffer, &BufferInterface::aboutToBeDestroyed, q, QObject::connect(pending.buffer, &BufferInterface::aboutToBeDestroyed, q, &SurfaceInterface::handleBufferRemoved, Qt::UniqueConnection);
[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);
} }
void SurfaceInterfacePrivate::surface_damage(Resource *, int32_t x, int32_t y, int32_t width, int32_t height) void SurfaceInterfacePrivate::surface_damage(Resource *, int32_t x, int32_t y, int32_t width, int32_t height)
...@@ -1011,4 +998,18 @@ QMatrix4x4 SurfaceInterface::surfaceToBufferMatrix() const ...@@ -1011,4 +998,18 @@ QMatrix4x4 SurfaceInterface::surfaceToBufferMatrix() const
return d->surfaceToBufferMatrix; 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 } // namespace KWaylandServer
...@@ -480,6 +480,8 @@ Q_SIGNALS: ...@@ -480,6 +480,8 @@ Q_SIGNALS:
void committed(); void committed();
private: private:
void handleBufferRemoved(BufferInterface *buffer);
QScopedPointer<SurfaceInterfacePrivate> d; QScopedPointer<SurfaceInterfacePrivate> d;
friend class SurfaceInterfacePrivate; 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