[qtdeclarative] Suppress focusObjectChanged events unless an actual change occurs
Merge pull request #27 from matthewvogt/focus-object-changed

[qtdeclarative] Suppress focusObjectChanged events unless an actual change occurs
[qtdeclarative] Don't prematurely cleanup GL resources

Hidden windows that had the persistent scenegraph flag set were
not being considered when deciding if GL resources could be
destroyed.  This meant that if these windows were reshown, and the
SG context was reestablished, old, invalid scenegraph nodes were
used and could lead to a crash.  The following simple program will cause
this crash:

int main(int argc, char **argv)
{
    QGuiApplication app(argc, argv);

    const char *source = "import QtQuick 2.0; Rectangle { width: 100; height: 100; Text { text: \"Hello\" } }";

    QQmlEngine engine;

    QQuickWindow *textWindow = new QQuickWindow;
    QQmlComponent textComponent(&engine);
    textComponent.setData(source, QUrl());
    QQuickItem *textItem = qobject_cast<QQuickItem *>(textComponent.create());
    textItem->setParentItem(textWindow->contentItem());

    QQuickWindow *closeWindow = new QQuickWindow;
    QQmlComponent closeComponent(&engine);
    closeComponent.setData(source, QUrl());
    QQuickItem *closeItem = qobject_cast<QQuickItem *>(closeComponent.create());
    closeItem->setParentItem(closeWindow->contentItem());

    textWindow->show();

    QTimer::singleShot(1000, textWindow, SLOT(hide()));
    QTimer::singleShot(2000, closeWindow, SLOT(show()));
    QTimer::singleShot(3000, closeWindow, SLOT(deleteLater()));
    QTimer::singleShot(4000, textWindow, SLOT(show()));

    return app.exec();
}

Fixes JB#11032