Fix access to uninitialized pointer

The C++ standard says in 9.4..2 that the object expression is evaluated,
so any compliant compiler may access d. So this syntax is a bug in this
place.

Change-Id: I37d2c4ea54febd40410ca473c906bcb1c66c4974
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
bb10
Tobias Hunger 2012-06-16 22:52:03 +02:00 committed by Qt by Nokia
parent 958aaf3770
commit 88cf9402e3
1 changed files with 1 additions and 1 deletions

View File

@ -512,7 +512,7 @@ public:
// special constructor that is enabled only if X derives from QObject
#if QT_DEPRECATED_SINCE(5, 0)
template <class X>
QT_DEPRECATED inline QWeakPointer(X *ptr) : d(ptr ? d->getAndRef(ptr) : 0), value(ptr)
QT_DEPRECATED inline QWeakPointer(X *ptr) : d(ptr ? Data::getAndRef(ptr) : 0), value(ptr)
{ }
#endif
#endif