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
committerOlivier Goffart <olivier.goffart@nokia.com>2011-05-10 12:54:56 +0200
commit202df2ae8914c3424c7a8c84303e70c37e62646d (patch)
tree136f09e5930baff3952c088395d3f90bbe068eda /src/corelib/io/qprocess_p.h
parentf38a639a419fda0024659bdc6c03e0b6250188f7 (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 (cherry picked from commit c79246683a5033f605acd59d1c37d68381383a06)
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: