From d35638df56b741bc7bc3cac228075040cdd8a931 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 9 Aug 2018 11:31:41 +0200 Subject: Do not modify environment for user applications We used to set QT_OPENGL, currently set LD_LIBRARY_PATH when qtcreator.sh is used, and might set other variables in the future, but these environment modifications should not be passed on to user applications or when we run tools that are not shipped with Qt Creator. For LD_LIBRARY_PATH there already was a hack for Environment::systemEnvironment. For environment variables that we might set in main() in the future, this patch caches the system environment for Environment::systemEnvironment early before any modifications are made. The previous hack for LD_LIBRARY_PATH no longer works, since it used QCoreApplication::applicationDirPath() which cannot be used at that point in time (before the QApplication has been created). Instead pass the correct user LD_LIBRARY_PATH directly from qtcreator.sh to Qt Creator through a command line option, which is cleaner anyhow. Task-number: QTCREATORBUG-20808 Change-Id: I6674a5e0537e1b37fd7dcbff371b542fa24bce69 Reviewed-by: Ulf Hermann Reviewed-by: Oswald Buddenhagen Reviewed-by: Tobias Hunger --- bin/qtcreator.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/qtcreator.sh b/bin/qtcreator.sh index 80fc4499c9..86826f1e3b 100755 --- a/bin/qtcreator.sh +++ b/bin/qtcreator.sh @@ -39,6 +39,7 @@ if test -d "$qtlibdir"; then qtlibpath=:$qtlibdir fi # Add Qt Creator library path +_ORIGINAL_LD_LIBRARY_PATH=$LD_LIBRARY_PATH LD_LIBRARY_PATH=$libdir:$libdir/qtcreator$qtlibpath${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} export LD_LIBRARY_PATH -exec "$bindir/qtcreator" ${1+"$@"} +exec "$bindir/qtcreator" -user-library-path "$_ORIGINAL_LD_LIBRARY_PATH" ${1+"$@"} -- cgit v1.2.3