From db91050fb5db5da3d2558d39fda344483ae3170d Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Sun, 5 Dec 2021 13:46:52 +0100 Subject: [PATCH] dmabuf-feedback: fix crash BUG: 446502 --- src/wayland/linuxdmabufv1clientbuffer.cpp | 13 ++++--------- src/wayland/linuxdmabufv1clientbuffer.h | 2 +- src/wayland/linuxdmabufv1clientbuffer_p.h | 2 -- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/wayland/linuxdmabufv1clientbuffer.cpp b/src/wayland/linuxdmabufv1clientbuffer.cpp index 6520075c69..2539b046bd 100644 --- a/src/wayland/linuxdmabufv1clientbuffer.cpp +++ b/src/wayland/linuxdmabufv1clientbuffer.cpp @@ -25,7 +25,7 @@ static const int s_version = 4; LinuxDmaBufV1ClientBufferIntegrationPrivate::LinuxDmaBufV1ClientBufferIntegrationPrivate(LinuxDmaBufV1ClientBufferIntegration *q, Display *display) : QtWaylandServer::zwp_linux_dmabuf_v1(*display, s_version) , 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); 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()); } @@ -86,11 +86,6 @@ void LinuxDmaBufV1ClientBufferIntegrationPrivate::zwp_linux_dmabuf_v1_create_par new LinuxDmaBufParamsV1(q, paramsResource); } -LinuxDmaBufV1ClientBufferIntegrationPrivate *LinuxDmaBufV1ClientBufferIntegrationPrivate::get(LinuxDmaBufV1ClientBufferIntegration *integration) -{ - return integration->d.data(); -} - LinuxDmaBufParamsV1::LinuxDmaBufParamsV1(LinuxDmaBufV1ClientBufferIntegration *integration, ::wl_resource *resource) : QtWaylandServer::zwp_linux_buffer_params_v1(resource) , m_integration(integration) @@ -437,8 +432,8 @@ ClientBuffer::Origin LinuxDmaBufV1ClientBuffer::origin() const } } -LinuxDmaBufV1Feedback::LinuxDmaBufV1Feedback(LinuxDmaBufV1ClientBufferIntegration *integration) - : d(new LinuxDmaBufV1FeedbackPrivate(LinuxDmaBufV1ClientBufferIntegrationPrivate::get(integration))) +LinuxDmaBufV1Feedback::LinuxDmaBufV1Feedback(LinuxDmaBufV1ClientBufferIntegrationPrivate *integration) + : d(new LinuxDmaBufV1FeedbackPrivate(integration)) { } diff --git a/src/wayland/linuxdmabufv1clientbuffer.h b/src/wayland/linuxdmabufv1clientbuffer.h index 430ce5a376..dbfba08857 100644 --- a/src/wayland/linuxdmabufv1clientbuffer.h +++ b/src/wayland/linuxdmabufv1clientbuffer.h @@ -135,7 +135,7 @@ public: void setTranches(const QVector &tranches); private: - LinuxDmaBufV1Feedback(LinuxDmaBufV1ClientBufferIntegration *integration); + LinuxDmaBufV1Feedback(LinuxDmaBufV1ClientBufferIntegrationPrivate *integration); friend class LinuxDmaBufV1ClientBufferIntegrationPrivate; friend class LinuxDmaBufV1FeedbackPrivate; QScopedPointer d; diff --git a/src/wayland/linuxdmabufv1clientbuffer_p.h b/src/wayland/linuxdmabufv1clientbuffer_p.h index ee500ea5e3..fad87e8c10 100644 --- a/src/wayland/linuxdmabufv1clientbuffer_p.h +++ b/src/wayland/linuxdmabufv1clientbuffer_p.h @@ -39,8 +39,6 @@ public: dev_t mainDevice; QHash> supportedModifiers; - static LinuxDmaBufV1ClientBufferIntegrationPrivate *get(LinuxDmaBufV1ClientBufferIntegration *integration); - protected: void zwp_linux_dmabuf_v1_bind_resource(Resource *resource) override; void zwp_linux_dmabuf_v1_destroy(Resource *resource) override;