diff options
| author | Thiago Macieira <thiago.macieira@intel.com> | 2025-09-16 15:32:13 -0700 |
|---|---|---|
| committer | Thiago Macieira <thiago.macieira@intel.com> | 2025-09-20 08:08:11 -0700 |
| commit | 1f86f801d207c11d101a152c1c69dcb6164639b7 (patch) | |
| tree | 697bcab0dfa76e886685f73a18e73e0f504721c3 /src/corelib/io | |
| parent | 28111a3f1795deb2d66cf45a6845a48fea4e893a (diff) | |
QLockFile: inline getLockFileHandle() so it's not in the QtCore DLL
It's only used by the unit test, so we shouldn't need it in regular
builds. In doing that, we can also fix the file descriptor leak on
Windows.
Pick-to: 6.10
Change-Id: I38f87e4acc15167f8284fffdf8d76f09242aa787
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/io')
| -rw-r--r-- | src/corelib/io/qlockfile.cpp | 13 | ||||
| -rw-r--r-- | src/corelib/io/qlockfile_p.h | 5 |
2 files changed, 5 insertions, 13 deletions
diff --git a/src/corelib/io/qlockfile.cpp b/src/corelib/io/qlockfile.cpp index fef20455732..908db7b9d38 100644 --- a/src/corelib/io/qlockfile.cpp +++ b/src/corelib/io/qlockfile.cpp @@ -458,18 +458,7 @@ bool QLockFilePrivate::isApparentlyStale() const return staleLockTime > 0ms && abs(age) > staleLockTime; } -int QLockFilePrivate::getLockFileHandle(QLockFile *f) -{ - int fd; -#ifdef Q_OS_WIN - // Use of this function on Windows WILL leak a file descriptor. - fd = _open_osfhandle(intptr_t(f->d_func()->fileHandle), 0); -#else - fd = f->d_func()->fileHandle; -#endif - QT_LSEEK(fd, 0, SEEK_SET); - return fd; -} + /*! Attempts to forcefully remove an existing lock file. diff --git a/src/corelib/io/qlockfile_p.h b/src/corelib/io/qlockfile_p.h index 8758adfb71e..2a7ebe1926d 100644 --- a/src/corelib/io/qlockfile_p.h +++ b/src/corelib/io/qlockfile_p.h @@ -52,7 +52,10 @@ public: bool isLocked = false; // used in tst_QLockFile: - Q_CORE_EXPORT static int getLockFileHandle(QLockFile *f); + static auto getLockFileHandle(QLockFile *f) + { + return f->d_func()->fileHandle; + } }; QT_END_NAMESPACE |
