From 7804eb41d9548c36254097f235324a3c57c6514f Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Wed, 8 May 2019 19:06:24 +0200 Subject: [PATCH] Fix crash due to dangling reference Summary: Returning a reference to a value on the stack is broken. This caused kwin_wayland to crash in openQA with a nullptr deref. BUG: 407199 Test Plan: Only build tested. Reviewers: #kwin, zzag Reviewed By: #kwin, zzag Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D21085 --- plugins/platforms/drm/drm_output.cpp | 4 ++-- plugins/platforms/drm/drm_output.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/platforms/drm/drm_output.cpp b/plugins/platforms/drm/drm_output.cpp index b042ccb78d..3710295624 100644 --- a/plugins/platforms/drm/drm_output.cpp +++ b/plugins/platforms/drm/drm_output.cpp @@ -144,7 +144,7 @@ int orientationToRotation(Qt::ScreenOrientation orientation) return 0; } -QMatrix4x4 &&DrmOutput::matrixDisplay(const QSize &s) const +QMatrix4x4 DrmOutput::matrixDisplay(const QSize &s) const { QMatrix4x4 matrix; const int angle = orientationToRotation(orientation()); @@ -156,7 +156,7 @@ QMatrix4x4 &&DrmOutput::matrixDisplay(const QSize &s) const matrix.translate(-center.width(), -center.height()); } matrix.scale(scale()); - return std::move(matrix); + return matrix; } void DrmOutput::updateCursor() diff --git a/plugins/platforms/drm/drm_output.h b/plugins/platforms/drm/drm_output.h index aeeb93759b..bc77d89919 100644 --- a/plugins/platforms/drm/drm_output.h +++ b/plugins/platforms/drm/drm_output.h @@ -135,7 +135,7 @@ private: int getGammaRampSize() const override; bool setGammaRamp(const ColorCorrect::GammaRamp &gamma) override; - QMatrix4x4 &&matrixDisplay(const QSize &s) const; + QMatrix4x4 matrixDisplay(const QSize &s) const; DrmBackend *m_backend; DrmConnector *m_conn = nullptr;