From 8272f5415b1ac89fd169513160870ab85bbf1bef Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 24 Apr 2015 10:47:29 +0200 Subject: Fix crashes when accessing environment variables concurrently MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We've seen crashes with QThreadPrivate::start using qgetenv during the creation of the event dispatcher, while another thread (for example the gui thread) called qputenv. This is inherently thread-unsafe and there are many places where we make the assumption that using the environment is safe. However access to the environment is inherently unsafe in the C runtime and the best that we can do is add a mutex around the Qt environment access functions, to at least protect ourselves and our users. Change-Id: Ie9a718d9f7ce63c423c645f0be3e3f4933e1cb08 Reviewed-by: Marc Mutz Reviewed-by: Jørgen Lind --- src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforminputcontexts/ibus') diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp index 673942b5d9..0b5775bc15 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp @@ -340,7 +340,7 @@ QIBusPlatformInputContextPrivate::QIBusPlatformInputContextPrivate() QDBusConnection *QIBusPlatformInputContextPrivate::createConnection() { - QByteArray display(getenv("DISPLAY")); + QByteArray display(qgetenv("DISPLAY")); QByteArray host = "unix"; QByteArray displayNumber = "0"; -- cgit v1.2.3