dmabuf-feedback: fix crash

BUG: 446502
This commit is contained in:
Xaver Hugl 2021-12-05 13:46:52 +01:00
parent 53064d9af3
commit db91050fb5
3 changed files with 5 additions and 12 deletions

View file

@ -25,7 +25,7 @@ static const int s_version = 4;
LinuxDmaBufV1ClientBufferIntegrationPrivate::LinuxDmaBufV1ClientBufferIntegrationPrivate(LinuxDmaBufV1ClientBufferIntegration *q, Display *display) LinuxDmaBufV1ClientBufferIntegrationPrivate::LinuxDmaBufV1ClientBufferIntegrationPrivate(LinuxDmaBufV1ClientBufferIntegration *q, Display *display)
: QtWaylandServer::zwp_linux_dmabuf_v1(*display, s_version) : QtWaylandServer::zwp_linux_dmabuf_v1(*display, s_version)
, q(q) , q(q)
, defaultFeedback(new LinuxDmaBufV1Feedback(q)) , defaultFeedback(new LinuxDmaBufV1Feedback(this))
{ {
} }
@ -66,7 +66,7 @@ void LinuxDmaBufV1ClientBufferIntegrationPrivate::zwp_linux_dmabuf_v1_get_surfac
} }
auto surfacePrivate = SurfaceInterfacePrivate::get(surface); auto surfacePrivate = SurfaceInterfacePrivate::get(surface);
if (!surfacePrivate->dmabufFeedbackV1) { if (!surfacePrivate->dmabufFeedbackV1) {
surfacePrivate->dmabufFeedbackV1.reset(new LinuxDmaBufV1Feedback(q)); surfacePrivate->dmabufFeedbackV1.reset(new LinuxDmaBufV1Feedback(this));
} }
LinuxDmaBufV1FeedbackPrivate::get(surfacePrivate->dmabufFeedbackV1.data())->add(resource->client(), id, resource->version()); LinuxDmaBufV1FeedbackPrivate::get(surfacePrivate->dmabufFeedbackV1.data())->add(resource->client(), id, resource->version());
} }
@ -86,11 +86,6 @@ void LinuxDmaBufV1ClientBufferIntegrationPrivate::zwp_linux_dmabuf_v1_create_par
new LinuxDmaBufParamsV1(q, paramsResource); new LinuxDmaBufParamsV1(q, paramsResource);
} }
LinuxDmaBufV1ClientBufferIntegrationPrivate *LinuxDmaBufV1ClientBufferIntegrationPrivate::get(LinuxDmaBufV1ClientBufferIntegration *integration)
{
return integration->d.data();
}
LinuxDmaBufParamsV1::LinuxDmaBufParamsV1(LinuxDmaBufV1ClientBufferIntegration *integration, ::wl_resource *resource) LinuxDmaBufParamsV1::LinuxDmaBufParamsV1(LinuxDmaBufV1ClientBufferIntegration *integration, ::wl_resource *resource)
: QtWaylandServer::zwp_linux_buffer_params_v1(resource) : QtWaylandServer::zwp_linux_buffer_params_v1(resource)
, m_integration(integration) , m_integration(integration)
@ -437,8 +432,8 @@ ClientBuffer::Origin LinuxDmaBufV1ClientBuffer::origin() const
} }
} }
LinuxDmaBufV1Feedback::LinuxDmaBufV1Feedback(LinuxDmaBufV1ClientBufferIntegration *integration) LinuxDmaBufV1Feedback::LinuxDmaBufV1Feedback(LinuxDmaBufV1ClientBufferIntegrationPrivate *integration)
: d(new LinuxDmaBufV1FeedbackPrivate(LinuxDmaBufV1ClientBufferIntegrationPrivate::get(integration))) : d(new LinuxDmaBufV1FeedbackPrivate(integration))
{ {
} }

View file

@ -135,7 +135,7 @@ public:
void setTranches(const QVector<Tranche> &tranches); void setTranches(const QVector<Tranche> &tranches);
private: private:
LinuxDmaBufV1Feedback(LinuxDmaBufV1ClientBufferIntegration *integration); LinuxDmaBufV1Feedback(LinuxDmaBufV1ClientBufferIntegrationPrivate *integration);
friend class LinuxDmaBufV1ClientBufferIntegrationPrivate; friend class LinuxDmaBufV1ClientBufferIntegrationPrivate;
friend class LinuxDmaBufV1FeedbackPrivate; friend class LinuxDmaBufV1FeedbackPrivate;
QScopedPointer<LinuxDmaBufV1FeedbackPrivate> d; QScopedPointer<LinuxDmaBufV1FeedbackPrivate> d;

View file

@ -39,8 +39,6 @@ public:
dev_t mainDevice; dev_t mainDevice;
QHash<uint32_t, QSet<uint64_t>> supportedModifiers; QHash<uint32_t, QSet<uint64_t>> supportedModifiers;
static LinuxDmaBufV1ClientBufferIntegrationPrivate *get(LinuxDmaBufV1ClientBufferIntegration *integration);
protected: protected:
void zwp_linux_dmabuf_v1_bind_resource(Resource *resource) override; void zwp_linux_dmabuf_v1_bind_resource(Resource *resource) override;
void zwp_linux_dmabuf_v1_destroy(Resource *resource) override; void zwp_linux_dmabuf_v1_destroy(Resource *resource) override;