Merge remote-tracking branch 'origin/stable' into dev

Conflicts:
	src/corelib/io/qsavefile_p.h
	src/corelib/tools/qregularexpression.cpp
	src/gui/util/qvalidator.cpp
	src/gui/util/qvalidator.h

Change-Id: I58fdf0358bd86e2fad5d9ad0556f3d3f1f535825
Don't clear the pointer in QScopedPointer's destructor

It helps in valgrinding applications. It's the difference between:
==17609==  Address 0x38 is not stack'd, malloc'd or (recently) free'd

and
==19789==  Address 0x598f478 is 56 bytes inside a block of size 112 free'd
==19789==    at 0x4A0736C: operator delete(void*) (vg_replace_malloc.c:480)
==19789==    by 0x53A77CD: QObjectPrivate::~QObjectPrivate() (qobject.cpp:239)
==19789==    by 0x53B4EB5: QScopedPointerDeleter<QObjectData>::cleanup(QObjectData*) (qscopedpointer.h:63)
==19789==    by 0x53B3980: QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::~QScopedPointer() (qscopedpointer.h:99)
==19789==    by 0x53A8EEC: QObject::~QObject() (qobject.cpp:750)

Change-Id: If42107c94401a96c05caa511442d6bd010fd4e29
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Rewrite QDBusConnection::unregisterObject to be recursive

The current implementation is a loop. We need it to be recursive so that
we can execute more operations when unwinding. This will be necessary
in the next commit.

Change-Id: Ia3c98fed0719cede0a0d92d3e343cf016ec7baf2
Reviewed-by: David Faure (KDE) <faure@kde.org>
Make the QtDBus object tree keep a count of active children

The new member variable activeChildren shall contain the number of
direct children that are active. This number differs from
children.count() because the vector may contain empty entries that
haven't been garbage-collected yet (obj == NULL and activeChildren ==
0).

When this count drops to zero, we know we can simply erase the vector of
children.

Change-Id: Ia20604d3fac852ea4a6e8862d934fbb936fa5e18
Reviewed-by: David Faure (KDE) <faure@kde.org>
Improve the QDBusConnection node children garbage collection

This replaces the implementation from ac9ab9703ff299c94dca7585d5a12e.

If the number of active children drops to zero, we know we can simply
delete the vector of children. We know none that might be there are
active.

If the number is not zero, but is considerably smaller than the vector
size, we can shrink the vector by reordering the elements, skipping the
inactive ones.

We use qMove, which expands to std::move on C++11, but a regular copy on
C++98.

Change-Id: I2e74446081f91fbd698425b08910fbda4746d673
Reviewed-by: David Faure (KDE) <faure@kde.org>
Remove debugging messages from QDBusConnection::registerObject

Qt does not print debugging in released versions. We print warnings in
case of error in using the API, but that's not the case here.

Change-Id: I14d54be5d6a1d4e1f147afd091ba850670972cdf
Reviewed-by: David Faure (KDE) <faure@kde.org>
Use Qt defined gettimeofday for VxWorks and no fallback to X11 version

VxWorks don't have gettimeofday function so we always use the one
implemented in Qt. VxWorks DIAB compiler is not supported building Qt
for VxWorks 6.9.2. Anyone using older VxWorks should also not be
affected so use new defines VXWORKS_DKM and VXWORKS_RTP for VxWorks
version 6.9.2 onward.

Change-Id: I2e9546a101256ea0557b65163b40cd0f28be8519
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
VxWorks header only available in DKM mode and not in RTP mode.

Check if _WRS_KERNEL is defined so we are compiling for DKM mode.

Change-Id: I15801b0575d3fe6e543f81a177fd01d015d9085f
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Use taskIdSelf() function instead of taskIdCurrent global variable

The uniprocessor taskIdCurrent global variable (declared in taskLib.h)
does not exist in VxWorks SMP, because of concurrent execution on
multiple CPUs. Any uniprocessor code that reads taskIdCurrent should
make calls to taskIdSelf() instead.

Change-Id: I4e0efef32297f339d6121c7d4bca3820e0fc9294
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Strip prepending <hostname>: string from currentPath() for VxSim

VxWorks simulator (VxSim) maps SDK rootdir usable as normal directory.
Mapped directory name is either host: or <hostname>: and can be used
without prepending prefix containing colon. Strip prepending string and
colon to get valid native path to host SDK rootdir running VxSim.

Change-Id: I9d2829e32431c2d50fefe55c93780cd37165e565
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Do not define QT_NO_DYNAMIC_LIBRARY for VxWorks process (RTP)

Shared libraries cannot be used in kernel mode (DKM), only at process
mode (RTP).

Change-Id: I8cecc12461aa4417b16577db3bc9cd85a1aa7efa
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Use stub function gettimeofday for VxWorks

Vxworks does not have gettimeofday function, use function
implementation from qfunctions_vxworks.h/cpp instead.

Change-Id: Iad2a71c8484ba00dd9406706b1c136297260de4b
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Use stub functions getpwuid and getgrgid for VxWorks

VxWorks has no concepts of users and groups, therefore no such functions
exists on VxWorks. Use stub functions from qfunctions_vxworks.h for
those, so we don't need to make major source code changes.

Change-Id: Iaad80ec18441e3d3e9c0f96e92ccc3766b27d976
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Use QDir::homePath() for tilde expansion

VxWorks does not have concept of users and therefore has no function
getpwnam. Use QDir::homePath() which returns actually QDir::rootPath()
if there is no HOME env variable set.

Change-Id: I15fe15862c4491b56cfa13bbdb218ef00dfd1f15
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
VxWorks process (RTP) mode does not have taskLock/taskUnlock functions

VxWorks does not support to globally lock and unlock the scheduler from
process. In kernel mode (DKM) above functions disable preemption from
requested task and such functionality does not exist for process.

Change-Id: Id41eab4c1973e4181e82539d08707659e0780f99
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Add support getting memory page size to RTP mode on VxWorks.

Change-Id: Id71bf7fd8e7371284076247558cba7edb0307e13
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Use sched_get_priority_* functions only for SCHED_RR and SCHED_FIFO

In VxWorks set default values for scheduling priority to use
SCHED_FIFO_HIGH_PRI and SCHED_FIFO_LOW_PRI defines for other scheduling
policies than SCHED_RR or SCHED_FIFO.

Change-Id: If78b84cd9ef94d7712206e9442e96cdba727610f
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Fix comments to use pre C99 standard style instead

VxWorks compiler fails to compile *.c file with C99 style comments on it

Change-Id: Ib5c5ff14006c17f9392b77363232b8b7cc112d34
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Use time.h related includes from qfunctions_vxworks.h file.

In VxWorks qfunctions_vxworks.h file includes correct time
related headers and it is included already at file
qplatformdefs.h for all mkspecs targets.

Change-Id: I8677eef8c79cebb445d89203284f3af27abbdd7f
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Check existence of QProcess feature before using it on Qt autotests.

VxWorks does not have QProcess support.

Change-Id: I20ed479125097d468a1aa50afb18c3749f0fbb98
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>