wayland: In test lock thread when setting env variables
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 <liang.qi@qt.io>
This commit is contained in:
parent
c72ba39e50
commit
a639807a8f
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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()
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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()
|
||||
|
@ -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 \
|
||||
|
@ -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;
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user