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