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
This commit is contained in:
Fabian Vogt 2019-05-08 19:06:24 +02:00
parent ee60653640
commit 7804eb41d9
2 changed files with 3 additions and 3 deletions

View file

@ -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()

View file

@ -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;