Avoid crash due to accessing deleted QWidgetWindow object

Change childWidget->windowHandle() to childWidget->internalWinId() in
q_createNativeChildrenAndSetParent() to determine whether should we call
childWidget->winId().
This is because in some circumstances Qt will crash due to accessing
deleted QWidgetWindow object if we use windowHandle(). Think about the
following scenario:

1) create a widget A without parent and add two child widgets B and C to A

2) create a native widget D as the child of B, note that when we set
Qt::WA_NativeWindow attribute to it, its QWidgetWindow will be created
which means its windowHandle() is not null.

3) create a top level widget E as the child of C and show it. This will
make Qt call createWinId() to A and then
q_createNativeChildrenAndSetParent() will be called to create A's native
children recursively and finally make D's QWidgetWindow object become a
child of A's QWidgetWindow object. Please note here that B will not become
a native widget just because at that moment windowHandle() of D is not
null and Qt will not call winId() to its parent B

4) Set A's parent to another widget which has been shown, setParent_sys()
will be called to A and then Qt will call destroy() to A. in destroy() Qt
will try to call destroy() to its children recursively with a condition that
the child has Qt::WA_NativeWindow been set. But D's parent B is not a native
widget right now so B and D is not destroyed. Qt will then deleted the
QWidgetWindow object of A, since E's QWidgetWindow object is a child of
A's QWidgetWindow object, it will also be deleted. Now E hold a deleted
pointer of QWidgetWindow object. This is the source of crash later.

Task-number: QTBUG-35600

Change-Id: I97a20a68e626ee62b15bb4eae580e26f8948923b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Fix ‘looses precision’ warning in public API

Change-Id: I935e6f278e539f8e6aaca0bc381371ec85aa5c67
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
XCB: Don't recalculate the DPI if we have a forced DPI setting

logicalDpi() already has the logic to check m_forcedDpi, so let's reuse
it. I hope it's not a problem that we send a signal that it changed when
nothing changed.

[ChangeLog][Platform Specific Changes][X11 / XCB]Fixed a bug that caused
Qt applications to think the screen DPI had changed when it had not,
after connecting or disconnecting monitors.

Task-number: QTBUG-32683
Change-Id: I45dd27de5109e65e7599915f11cfdb633a65a67c
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
xcb: added env variables to show input devices and events

export QT_XCB_DEBUG_XINPUT_DEVICES=anything to show detected
input devices at startup
export QT_XCB_DEBUG_XINPUT=anything to log mouse, touch and tablet events

Change-Id: Id14844b68ad376740f82a36aab2c59c84d2017ab
Task-number: QTBUG-35583
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
fix compile of qt without egl available

move the dpy to the place where it is used inside the egl ifdef guard
fixes compilation on old distros not having egl

Change-Id: I7eebe5305f3a584c0c5da2ea7b9099fdd994249d
Reviewed-by: David Faure <david.faure@kdab.com>
Doc: Polish Qt::ConnectionType descriptions

- Shorten Qt::AutoConnection description, rearrange to match the order
  of the subsequent rows.
- Note the thread used in Qt::DirectConnection
- "Emitter's thread" is ambiguous -- a signal is not necessarily
  emitted from the thread that the emitter lives in.
- Misusing Qt::BlockingQueuedConnection WILL (not "can") cause a
  deadlock. Qt even issues an error message before it freezes.
- Remove the \note command -- it breaks the table and displays the note
  in a new paragraph.

Change-Id: Ib60cb665e0cd23e1e072402ec5d8be344b8454f7
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Add mtdev configure test

Change-Id: If989b479ed4babf902099c54be59ae73512820d5
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
linuxfb: Make mouse cursor behavior match eglfs

On non-Android systems hideCursor should default to false, just
like it is done in eglfs. This is especially useful on udev-less
systems where currently one has to resort to setting
QT_QPA_FB_HIDECURSOR to "0" to enable the mouse cursor. This is
not ideal. Defaulting to showing the cursor unless disabled by
the environment variable or, in absence of that, the lack of a
mouse reported by udev is a better choice.

Change-Id: I7362ac47046179d5eb8ed8b44cf2c36c0fc23432
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
mtdev: Change to use configure detection instead of requiring source hacking.

This coincidentally fixes a case of accidental BIC in qevdevtouch_p.h, where not
all users would necessarily define USE_MTDEV: having it centralized inside Qt
makes this now, blessedly, impossible.

Change-Id: I196a8f21742830705759aa917a823afdc94ba2b5
Done-with: Michael Brasser <michael.brasser@jollamobile.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Windows platform plugin: Add missing case statement

Change-Id: I9b9fc6cf000b262277711374e0a2fe119328849e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Improve QFileSelector doc

Mostly just adding proper tags and sections, as well as a few
grammatical fixes.

Change-Id: I219517d740fa7385e923a9e09cb7e241378fcbdd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Martin Smith <martin.smith@digia.com>
Don't leak pending call objects when peer disconnects

Unlike in regular connection to DBus server, we don't get pending call
notifies when a peer drops the connection in peer-to-peer mode.

Thus, we need to keep track of pending calls in such cases and get rid of
them in ~QDBusConnectionPrivate().

Change-Id: I83e20db0bc7b2ebf509c7fdb1382ffc7d0ede9d3
Done-with: Kalle Vahlman <kalle.vahlman@movial.com>
Reviewed-by: Daniele E. Domenichelli <daniele.domenichelli@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
xcb platform: Fix build when both EGL and xcb-Xlib are used

Fix a multiple define when Qt is configured to use both EGL and xcb-Xlib.

Change-Id: I6fdb282f575842711b3b5d377bbdf3bc9909bf0c
Reviewed-by: Christoph Cullmann <cullmann@kde.org>
Reviewed-by: David Faure <david.faure@kdab.com>
qdoc: Fix Q_PROPERTY parsing

When parsing Q_PROPERTY declarations, qdoc tries to always
read an associated value for each matched keyword. This
fails for property declarations including a CONSTANT or
FINAL, as they have no associated values.

This change fixes the above problem and makes the parsing
more robust by checking the return value of matchProperty()
and skipping to closing parenthesis in case of failure.

Task-number: QTBUG-35722
Change-Id: Ia483b8e74aeef19b2e761b21473cd4f765cdca19
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Martin Smith <martin.smith@digia.com>
Accessibility: Do not assert when a widget doesn't have a QAI

[ChangeLog][QtGui] Fixed crash when sending accessibility updates when
the corresponding widget does not have a corresponding
QAccessibleInterface. This showed on Mac for example with QStatusBar.

Task-number: QTBUG-35421
Change-Id: I94174e98e858b7a0122532ee5fcc8458a263bccd
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Fix some typos in documentation.

Fix some spelling and grammatical errors in comments that show up in Qt documentation. No changes to code.

Change-Id: I2e946fda0bd9a2117f8e9b2fb300df9bf0a98a6c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Android: Don't show ActionBar at startup.

Task-number: QTBUG-35151

Change-Id: Ie62e50032aaa647a86c4f03b1a3363e5ef6a1bbb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Android: Overwrite plugin cache when APK is updated

To allow updating APKs with new versions of Qt, we need
to delete the old cache when the APK is updated. This patch
does two things:

1. Move the plugins (and imports/qml) into a directory called
qt-reserved-files/ to better separate the cache from the rest
of the application. The first time the files are put here,
we will delete the old cache in <datadir>/plugins,
<datadir>/imports and <datadir>/qml if they exist to avoid
leaving old files around forever.

2. Add versioning to the cache and flush it every time the
APK is reinstalled. Potentially, the libraries in the APK
can change for every reinstall, so this is the safest
approach.

Task-number: QTBUG-35129
[ChangeLog][Android][QTBUG-35129] Update deployed plugins
and imports when APK is updated on the device.

Change-Id: Ie38b639db2cfba8a521acc875c4afd5e07df3efd
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Android: let fullscreen use entire screen

API level 19 (Android 4.4) introduces "immersive" mode which lets
the app use the entire screen.

Change-Id: I12f6aebaf1303cdc5b6bfb51944e895351fa2406
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Add missed header to qfileselector.cpp.

Change-Id: I2fd6fb2ae1663730a008221f6beeef19a5307246
Reviewed-by: David Faure <david.faure@kdab.com>