Fix crash due to dangling reference
Returning a reference to a value on the stack is broken.
This caused kwin_wayland to crash in openQA with a nullptr deref.
Test Plan: Only build tested.
Reviewers: KWin, zzag
Reviewed By: KWin, zzag
Differential Revision: https://phabricator.kde.org/D21085