summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess_p.h
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-05-04 22:06:36 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-05-04 22:20:42 +0200
commitc79246683a5033f605acd59d1c37d68381383a06 (patch)
tree1af0c1041df040b69719a78e134ab8d9aa06067e /src/corelib/io/qprocess_p.h
parent56443421cb5e537e60abd7ced42c9ebf587683fe (diff)
don't crash in QProcessEnvironment::systemEnvironment()
as the implementations moved to platform-specific files, the QSharedDataPointer<QProcessEnvironmentPrivate>::detach() specialization needs to go to the private header. Reviewed-by: thiago
Diffstat (limited to 'src/corelib/io/qprocess_p.h')
-rw-r--r--src/corelib/io/qprocess_p.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index f70579bd17..54d49361be 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -182,6 +182,18 @@ public:
void insert(const QProcessEnvironmentPrivate &other);
};
+template<> Q_INLINE_TEMPLATE void QSharedDataPointer<QProcessEnvironmentPrivate>::detach()
+{
+ if (d && d->ref == 1)
+ return;
+ QProcessEnvironmentPrivate *x = (d ? new QProcessEnvironmentPrivate(*d)
+ : new QProcessEnvironmentPrivate);
+ x->ref.ref();
+ if (d && !d->ref.deref())
+ delete d;
+ d = x;
+}
+
class QProcessPrivate : public QIODevicePrivate
{
public: