diff options
-rw-r--r-- | src/corelib/io/qprocess.cpp | 13 | ||||
-rw-r--r-- | tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp | 10 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 218e8b959c..8a1fda6ccb 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -264,11 +264,16 @@ bool QProcessEnvironment::operator==(const QProcessEnvironment &other) const { if (d == other.d) return true; - if (d && other.d) { - QProcessEnvironmentPrivate::OrderedMutexLocker locker(d, other.d); - return d->hash == other.d->hash; + if (d) { + if (other.d) { + QProcessEnvironmentPrivate::OrderedMutexLocker locker(d, other.d); + return d->hash == other.d->hash; + } else { + return isEmpty(); + } + } else { + return other.isEmpty(); } - return false; } /*! diff --git a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp index fb64a48362..2099101a91 100644 --- a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp +++ b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp @@ -66,11 +66,19 @@ void tst_QProcessEnvironment::operator_eq() QVERIFY(e1 == e2); e1.clear(); - QVERIFY(e1 != e2); + QVERIFY(e1 == e2); e2.clear(); + QVERIFY(e1 == e2); + e1.insert("FOO", "bar"); + QVERIFY(e1 != e2); + + e2.insert("FOO", "bar"); QVERIFY(e1 == e2); + + e2.insert("FOO", "baz"); + QVERIFY(e1 != e2); } void tst_QProcessEnvironment::clearAndIsEmpty() |