[scripting] Avoid threading issues when loading from a file
Summary:
KWin::Script::loadScriptFromFile ran in it's own thread and accessed
member variables of KWin::Script without any guards.
Potentially script could be destroyed whilst the file is loading.
Rather than adding mutexes everywhere, this patch scopes the QFile
object to be local to the threaded function making it independent.
BUG: 403038
Test Plan: Ran a script from a file
Reviewers: KWin, graesslin
Reviewed By: KWin, graesslin
Subscribers: kwin
Tags: KWin
Differential Revision: https://phabricator.kde.org/D18126