diff options
| author | Ivan Solovev <ivan.solovev@qt.io> | 2023-11-07 11:11:59 +0100 |
|---|---|---|
| committer | Ivan Solovev <ivan.solovev@qt.io> | 2023-11-07 15:43:05 +0100 |
| commit | fb1dcbfcba35fe436b7be1c851a129da9f98cb55 (patch) | |
| tree | e57fc42a7585d87bf21f2914c9b39bfd0c378bfa /src/corelib/ipc | |
| parent | aa8dfc5589e26fe10c5e5ca439b0a4a4212d0b1f (diff) | |
QSharedMemory: fix attach() -> create() for legacy SystemV mode
The attach() -> create() sequence was not covered by unit-tests in
qtbase, but this approach is used inside QSharedImageLoader.
It turns out that 02c42b26e1ff94047657c4838128cb5b22d24d2b broke this
usecase for legacy mode, and the create() triggered an assertion
in QSharedMemorySystemV::updateNativeKeyFile(). Fix it by clearing
the nativeKeyFile if ftok() call in QSharedMemorySystemV::handle()
fails().
Add unit-tests for the attach() -> create() scenario.
These tests revealed that this scenario fails also in non-legacy mode
for SystemV, so add QEXPECT_FAIL for these cases for now. This will
be addressed in a separate patch.
Pick-to: 6.6
Change-Id: If133fa56c82eba902374dc48d2757046b3d40baf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/corelib/ipc')
| -rw-r--r-- | src/corelib/ipc/qsharedmemory_systemv.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/ipc/qsharedmemory_systemv.cpp b/src/corelib/ipc/qsharedmemory_systemv.cpp index 716b7aedd11..ddf9a36cd67 100644 --- a/src/corelib/ipc/qsharedmemory_systemv.cpp +++ b/src/corelib/ipc/qsharedmemory_systemv.cpp @@ -76,6 +76,7 @@ key_t QSharedMemorySystemV::handle(QSharedMemoryPrivate *self) unix_key = ftok(nativeKeyFile, int(self->nativeKey.type())); if (unix_key < 0) { self->setUnixErrorString("QSharedMemory::handle"_L1); + nativeKeyFile.clear(); unix_key = 0; } return unix_key; |
