Fix possible heap-use-after-free in idle inhibition handling
Thanks to build.kde.org for detecting and reporting this issue.