diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2021-08-30 18:21:41 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2021-08-31 08:45:59 +0000 |
commit | 99cf99579ea5d79be7516de33cabf49c9ea80456 (patch) | |
tree | 33f8ab019434fb9c895dfd276618d3f3d98b6e89 /src/libs/utils/launcherinterface.h | |
parent | 236074423cc489f039f9d81907cdcaeb2db36418 (diff) |
Make access to LauncherSocket thread safe
Instead of returning a pointer to LauncherSocket instance,
which might get deleted in meantime of just after,
route all calls to the LauncherSocket through the LauncherInterface.
Make all calls to LauncherInterface secured by the
instance mutex.
Change-Id: I751228de5f4263112471098ee08cc73a5245147e
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/libs/utils/launcherinterface.h')
-rw-r--r-- | src/libs/utils/launcherinterface.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/libs/utils/launcherinterface.h b/src/libs/utils/launcherinterface.h index 226792499ce..971525f7506 100644 --- a/src/libs/utils/launcherinterface.h +++ b/src/libs/utils/launcherinterface.h @@ -27,13 +27,17 @@ #include "utils_global.h" +#include "processutils.h" + #include <QObject> #include <QThread> namespace Utils { namespace Internal { -class LauncherSocket; +class CallerHandle; +class LauncherHandle; class LauncherInterfacePrivate; +class ProcessLauncherImpl; } class QTCREATOR_UTILS_EXPORT LauncherInterface : public QObject @@ -42,13 +46,21 @@ class QTCREATOR_UTILS_EXPORT LauncherInterface : public QObject public: static void startLauncher(const QString &pathToLauncher = {}); static void stopLauncher(); - static Internal::LauncherSocket *socket(); - static bool isStarted(); signals: void errorOccurred(const QString &error); private: + friend class Utils::Internal::CallerHandle; + friend class Utils::Internal::LauncherHandle; + friend class Utils::Internal::ProcessLauncherImpl; + + static bool isStarted(); + static bool isReady(); + static void sendData(const QByteArray &data); + static Utils::Internal::CallerHandle *registerHandle(quintptr token, ProcessMode mode); + static void unregisterHandle(quintptr token); + LauncherInterface(); ~LauncherInterface() override; |