summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-12-10 10:29:22 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-12-10 11:08:06 (GMT)
commit4d3839eb99d720393e1386d63fa04c83367bb076 (patch)
tree00d7662e9d4f37a2e6e15fe29123f4e5db2b04d4 /src/corelib
parent16e4047a627d85182d9d9622a839fa51a9650aca (diff)
downloadQt-4d3839eb99d720393e1386d63fa04c83367bb076.zip
Qt-4d3839eb99d720393e1386d63fa04c83367bb076.tar.gz
Qt-4d3839eb99d720393e1386d63fa04c83367bb076.tar.bz2
Ensure that QProcessEnvironment::operator== doesn't crash
Also add an extensive autotest suite for QProcessEnvironment Task-number: QTBUG-6701 Reviewed-by: Markus Goetz
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qprocess.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 37161bc..c78af3c 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -275,7 +275,7 @@ QProcessEnvironment &QProcessEnvironment::operator=(const QProcessEnvironment &o
*/
bool QProcessEnvironment::operator==(const QProcessEnvironment &other) const
{
- return d->hash == other.d->hash;
+ return d == other.d || (d && other.d && d->hash == other.d->hash);
}
/*!
@@ -334,6 +334,7 @@ bool QProcessEnvironment::contains(const QString &name) const
*/
void QProcessEnvironment::insert(const QString &name, const QString &value)
{
+ // d detaches from null
d->hash.insert(prepareName(name), prepareValue(value));
}