Don't leave the GL context current after cleanup.

When shutting down, we left the gl context current on the window even
when it was hidden. On mac this was a problem as it would optimize
away our makeCurrent when the surface was made visible again, leading
to nothing being rendered. So we call doneCurrent regardless during
invalidateGL(). We also check and verify that makeCurrent in
invalidateGL() actually succeeds.

This lead to another problem which is that closing the app using [x]
will call QWindow::destroy() on all windows, removing their platform
windows and causing makeCurrent to fail. To still gracefully clean up
resources, we introduced the concept of an offscreen fallback surface
which is temporarirly used during the cleanup when needed.

The problem is still present on QWindow+QOpenGLContext level, and
I've opened QTBUG-35363 to fix this.

Task-number: QTBUG-35234
Change-Id: Ie76dbe5fd4ab935db3da34f3ff63d217a3ba5013
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Fix binding loop in Maroon in Trouble QML demo

Task-number: QTBUG-35210
Change-Id: I44bd9f19acba5b59711aa4ca3d2b12c246afcc59
Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Reviewed-by: Sebastian Wozny <swozny@blackberry.com>
Revert "Revert ffaf39e9a7f11d4e2800b3b37160a2a952795614"

This reverts commit 27052dcad9810869a9065da4c06e9f14379411d7.

While the additional flexibility would be nice, I've been reminded that
we already did commit to it back in July.

Change-Id: Iaf990dda98ee46eb028b4737bdeeafd050d9513f
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
static builds: add classname entry to qmldir for QtQuick.Dialogs.Private

Add classname entry to qmldir, otherwise qmlimportscanner cannot
utilize it when doing static builds (on iOS).

Task-number: QTBUG-35369

Change-Id: If5440ffcdd805a832d4ff1d129e9f24d222b45d5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
QQmlImport: Don't try use a dangling pointer.

toUtf8 would return a temporary, and constData would hold a pointer inside that
temporary. This isn't even remotely safe. Move the pointer use down to the
initializeEngine call so it is kept around long enough for us to do our stuff.

This is a backport of cf51cdb8fb002ae3602a4c886e7c67913d77373a.

Task-number: QTBUG-35355
Task-number: QTBUG-35343
Change-Id: I338ad7f4d4137445ed9a311a293ea82bf023aafd
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Fix a crash in JSON.parse

Properly set members that are actually array indices
and don't crash when trying to set those.

Task-number: QTBUG-35383
Change-Id: I04d4b65c27e97a2e9db19541ed46ee1bb202f780
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Fix broken visibility property assignment after d0644b040e

Task-number: QTBUG-35412
Change-Id: I09feca09030a2eb07aa1abebf65481d68b880c79
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Set the format for the fallback offscreen surface

Ie76dbe5fd4ab935db3da34f3ff63d217a3ba5013 fails to set the format
for the QOffscreenSurface, resulting in BAD_MATCH failures when trying
to make it current.

Task-number: QTBUG-35410
Change-Id: I1d420556fad4df96a1893cb3513e398eeb6e71aa
Reviewed-by: Lars Knoll <lars.knoll@digia.com>