From 4dca0cba304d18d19ec54df7dac719799279bc18 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 29 Sep 2017 23:59:03 -0700 Subject: QLockInfo: Centralize the management of the lock file's contents We duplicated both the creation of the contents and the check if the file was stale. Centralize everything in qlockfile.cpp. Change-Id: I0b48fc8e90304e0dacc3fffd14e91174af79841f Reviewed-by: Oswald Buddenhagen Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/io/qlockfile_p.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/corelib/io/qlockfile_p.h') diff --git a/src/corelib/io/qlockfile_p.h b/src/corelib/io/qlockfile_p.h index a6f61b20f3..b41dfb38ad 100644 --- a/src/corelib/io/qlockfile_p.h +++ b/src/corelib/io/qlockfile_p.h @@ -78,12 +78,14 @@ public: } QLockFile::LockError tryLock_sys(); bool removeStaleLock(); - bool getLockInfo(qint64 *pid, QString *hostname, QString *appname) const; + QByteArray lockFileContents() const; // Returns \c true if the lock belongs to dead PID, or is old. // The attempt to delete it will tell us if it was really stale or not, though. bool isApparentlyStale() const; + // used in dbusmenu Q_CORE_EXPORT static QString processNameByPid(qint64 pid); + static bool isProcessRunning(qint64 pid, const QString &appname); QString fileName; #ifdef Q_OS_WIN -- cgit v1.2.3