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>