restore QProcessEnvironment shared data thread safety on unix
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>
Fri, 19 Apr 2013 16:11:05 +0000 (18:11 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 12 Aug 2013 16:58:01 +0000 (18:58 +0200)
commit9c2c12b3ef1a17d54559d229bd788bcf1b731d55
tree13c6e9dd34ea78930402c5acf67b9dbb3fc24edf
parente9ff4a5d3f01ce0e107a1f797446b92a6e52fc0e
restore QProcessEnvironment shared data thread safety on unix

implicit sharing together with 'mutable' is a time bomb.

we need to protect the nameMap, because concurrent "reads" may try to
insert into the hash, which would go boom.
we need to protect the key/value of Hash objects, because while the
refcounting is atomic, the d pointer assignments are not, which would
also go boom.

we can simply use a QMutex to protect the whole environment, because it
is very cheap in the uncontended case.

Task-number: QTBUG-30779
Change-Id: Iaad5720041ca06691d75eb9c6c0e1c120d4a7b46
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
(cherry picked from qtbase/85e61297f7b02297641826332dbdbc845a88c34b)
src/corelib/io/qprocess.cpp
src/corelib/io/qprocess_p.h
src/corelib/io/qprocess_unix.cpp