diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-24 10:47:29 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-30 14:21:46 +0000 |
commit | 8272f5415b1ac89fd169513160870ab85bbf1bef (patch) | |
tree | 41a7337c7e24f319a99ed0785b080cc5d0e67671 /src/plugins/platforminputcontexts/ibus | |
parent | 4b9cf0379ff320dd77b7957ad1865187a8bc3562 (diff) |
Fix crashes when accessing environment variables concurrently
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 <marc.mutz@kdab.com>
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforminputcontexts/ibus')
-rw-r--r-- | src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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"; |