diff options
author | David Edmundson <[email protected]> | 2025-06-03 11:08:20 +0300 |
---|---|---|
committer | David Edmundson <[email protected]> | 2025-06-04 00:23:23 +0300 |
commit | a639807a8f86fc8203baaac5d731676bef79382e (patch) | |
tree | 54233005e04cd389de02501470e4fc0184b9b574 | |
parent | c72ba39e50fea0c84fc93986aa587becd2e053b9 (diff) |
putenv/setenv are not thread safe. The Qt wrappers lock a mutex
but this only works if all users use it.
Fixes: QTBUG-136450
Pick-to: 6.10
Change-Id: I9a46b5be607c84436864afcf7eb063275e065738
Reviewed-by: Liang Qi <[email protected]>
-rw-r--r-- | tests/auto/wayland/client/tst_client.cpp | 6 | ||||
-rw-r--r-- | tests/auto/wayland/clientextension/tst_clientextension.cpp | 6 | ||||
-rw-r--r-- | tests/auto/wayland/cursor/tst_cursor.cpp | 2 | ||||
-rw-r--r-- | tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp | 8 | ||||
-rw-r--r-- | tests/auto/wayland/reconnect/tst_reconnect.cpp | 6 | ||||
-rw-r--r-- | tests/auto/wayland/scaling/tst_scaling.cpp | 2 | ||||
-rw-r--r-- | tests/auto/wayland/shared/mockcompositor.h | 6 | ||||
-rw-r--r-- | tests/auto/wayland/wl_connect/tst_wlconnect.cpp | 4 | ||||
-rw-r--r-- | tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 2 |
9 files changed, 21 insertions, 21 deletions
diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index fa4a81e195f..05894540f0b 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -596,11 +596,11 @@ void tst_WaylandClient::longWindowTitleWithUtf16Characters() int main(int argc, char **argv) { QTemporaryDir tmpRuntimeDir; - setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); - setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin + qputenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit()); + qputenv("QT_QPA_PLATFORM", "wayland"); // force QGuiApplication to use wayland plugin QString shell = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_SHELL_INTEGRATION")); if (shell.isEmpty()) - setenv("QT_WAYLAND_SHELL_INTEGRATION", "wl-shell", 1); + qputenv("QT_WAYLAND_SHELL_INTEGRATION", "wl-shell"); tst_WaylandClient tc; QGuiApplication app(argc, argv); diff --git a/tests/auto/wayland/clientextension/tst_clientextension.cpp b/tests/auto/wayland/clientextension/tst_clientextension.cpp index 8dd4e0d98f6..c68994228d1 100644 --- a/tests/auto/wayland/clientextension/tst_clientextension.cpp +++ b/tests/auto/wayland/clientextension/tst_clientextension.cpp @@ -121,9 +121,9 @@ void tst_clientextension::globalRemoved() int main(int argc, char **argv) { QTemporaryDir tmpRuntimeDir; - setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); - setenv("QT_QPA_PLATFORM", "wayland", 1); - setenv("QT_WAYLAND_DONT_CHECK_SHELL_INTEGRATION", "1", 1); + qputenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit()); + qputenv("QT_QPA_PLATFORM", "wayland"); + qputenv("QT_WAYLAND_DONT_CHECK_SHELL_INTEGRATION", "1"); tst_clientextension tc; QGuiApplication app(argc, argv); diff --git a/tests/auto/wayland/cursor/tst_cursor.cpp b/tests/auto/wayland/cursor/tst_cursor.cpp index 303802667a9..5bccf09caa1 100644 --- a/tests/auto/wayland/cursor/tst_cursor.cpp +++ b/tests/auto/wayland/cursor/tst_cursor.cpp @@ -42,7 +42,7 @@ CursorShapeDevice* tst_cursor::cursorShape() void tst_cursor::init() { - setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); + qputenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1"); } void tst_cursor::setCursor() diff --git a/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp b/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp index ba897d53f21..0abe6be5411 100644 --- a/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp +++ b/tests/auto/wayland/fullscreenshellv1/tst_fullscreenshellv1.cpp @@ -35,10 +35,10 @@ void tst_WaylandClientFullScreenShellV1::createDestroyWindow() int main(int argc, char **argv) { QTemporaryDir tmpRuntimeDir; - setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); - setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin - setenv("QT_WAYLAND_SHELL_INTEGRATION", "fullscreen-shell-v1", 1); - setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); // window decorations don't make much sense here + qputenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit()); + qputenv("QT_QPA_PLATFORM", "wayland"); // force QGuiApplication to use wayland plugin + qputenv("QT_WAYLAND_SHELL_INTEGRATION", "fullscreen-shell-v1"); + qputenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1"); // window decorations don't make much sense here tst_WaylandClientFullScreenShellV1 tc; QGuiApplication app(argc, argv); diff --git a/tests/auto/wayland/reconnect/tst_reconnect.cpp b/tests/auto/wayland/reconnect/tst_reconnect.cpp index 5f3d49bd38d..b41cfdd9499 100644 --- a/tests/auto/wayland/reconnect/tst_reconnect.cpp +++ b/tests/auto/wayland/reconnect/tst_reconnect.cpp @@ -247,9 +247,9 @@ int main(int argc, char **argv) // test rather than fail. Making sure it finishes is important! QTemporaryDir tmpRuntimeDir; - setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin - setenv("QT_WAYLAND_RECONNECT", "1", 1); - setenv("XDG_CURRENT_DESKTOP", "qtwaylandtests", 1); + qputenv("QT_QPA_PLATFORM", "wayland"); // force QGuiApplication to use wayland plugin + qputenv("QT_WAYLAND_RECONNECT", "1"); + qputenv("XDG_CURRENT_DESKTOP", "qtwaylandtests"); tst_WaylandReconnect tc; QGuiApplication app(argc, argv); diff --git a/tests/auto/wayland/scaling/tst_scaling.cpp b/tests/auto/wayland/scaling/tst_scaling.cpp index de36d34aa1d..3ba2c994726 100644 --- a/tests/auto/wayland/scaling/tst_scaling.cpp +++ b/tests/auto/wayland/scaling/tst_scaling.cpp @@ -23,7 +23,7 @@ private slots: void tst_scaling::init() { - setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); + qputenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1"); } void tst_scaling::scaledWindow() diff --git a/tests/auto/wayland/shared/mockcompositor.h b/tests/auto/wayland/shared/mockcompositor.h index 0e90982614c..21c565944f1 100644 --- a/tests/auto/wayland/shared/mockcompositor.h +++ b/tests/auto/wayland/shared/mockcompositor.h @@ -85,9 +85,9 @@ public: int main(int argc, char **argv) \ { \ QTemporaryDir tmpRuntimeDir; \ - setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); \ - setenv("XDG_CURRENT_DESKTOP", "qtwaylandtests", 1); \ - setenv("QT_QPA_PLATFORM", "wayland", 1); \ + qputenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit()); \ + qputenv("XDG_CURRENT_DESKTOP", "qtwaylandtests"); \ + qputenv("QT_QPA_PLATFORM", "wayland"); \ test tc; \ QGuiApplication app(argc, argv); \ QTEST_SET_MAIN_SOURCE_PATH \ diff --git a/tests/auto/wayland/wl_connect/tst_wlconnect.cpp b/tests/auto/wayland/wl_connect/tst_wlconnect.cpp index d66d0ad6a4a..1fbf4c458fe 100644 --- a/tests/auto/wayland/wl_connect/tst_wlconnect.cpp +++ b/tests/auto/wayland/wl_connect/tst_wlconnect.cpp @@ -15,8 +15,8 @@ private slots: // unable to connect to a compositor // Make sure the connection actually fails - setenv("XDG_RUNTIME_DIR", "/dev/null", 1); // a place where there are no Wayland sockets - setenv("WAYLAND_DISPLAY", "qt_invalid_socket", 1); // just to be sure + qputenv("XDG_RUNTIME_DIR", "/dev/null"); // a place where there are no Wayland sockets + qputenv("WAYLAND_DISPLAY", "qt_invalid_socket"); // just to be sure QStringList arguments; QString platformPluginPath; diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 72200ce72b6..5004aa6c038 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -42,7 +42,7 @@ private slots: void tst_xdgshell::init() { - setenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1", 1); + qputenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1"); } void tst_xdgshell::showMinimized() |