From 202df2ae8914c3424c7a8c84303e70c37e62646d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 4 May 2011 22:06:36 +0200 Subject: don't crash in QProcessEnvironment::systemEnvironment() as the implementations moved to platform-specific files, the QSharedDataPointer::detach() specialization needs to go to the private header. Reviewed-by: thiago (cherry picked from commit c79246683a5033f605acd59d1c37d68381383a06) --- src/corelib/io/qprocess_p.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/corelib/io/qprocess_p.h') 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::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: -- cgit v1.2.3