mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
Fix stack-use-after-scope reading QT_QPA_PLATFORM env var
Setting QT_QPA_PLATFORM with putenv from a local variable causes the environment to later still refer to it when it's out of scope. Use setenv instead, as it copies the values provided.
This commit is contained in:
committed by
Baldur Karlsson
parent
9c8bb99494
commit
a0e52feba1
@@ -203,10 +203,9 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
const char *qpa_plat = getenv("QT_QPA_PLATFORM");
|
||||
// if not set or empty, force non-wayland to help go through backwards compatibility path on wayland.
|
||||
char env_set[] = "QT_QPA_PLATFORM=xcb\0";
|
||||
if(!qpa_plat || qpa_plat[0] == 0)
|
||||
{
|
||||
putenv(env_set);
|
||||
setenv("QT_QPA_PLATFORM", "xcb", 1);
|
||||
envChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user