aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-12-12 18:06:30 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-12-12 18:06:30 +0100
commit82913414623f36acb3d2c07d6c124af9f61fcdb4 (patch)
tree610f66dd1fcb487e20bbf18587e8cfad38a40826 /src
parentd34098d8981d9103626ff7264e7b5ec084bfb63e (diff)
parentf95fdacb3a12e4f0d37d3c32b34326f2bd1536de (diff)
Merge remote-tracking branch 'origin/release' into stable
Conflicts: src/qml/qml/qqmlcompiler.cpp Change-Id: I802731139d47c5b733dd805f7bf432d67d7331e1
Diffstat (limited to 'src')
-rw-r--r--src/imports/dialogs-private/qmldir1
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp9
-rw-r--r--src/qml/qml/qml.pri2
-rw-r--r--src/qml/qml/qqmlabstracturlinterceptor.cpp3
-rw-r--r--src/qml/qml/qqmlabstracturlinterceptor.h (renamed from src/qml/qml/qqmlabstracturlinterceptor_p.h)4
-rw-r--r--src/qml/qml/qqmlcompiler.cpp2
-rw-r--r--src/qml/qml/qqmlcontext.cpp2
-rw-r--r--src/qml/qml/qqmlengine.cpp2
-rw-r--r--src/qml/qml/qqmlfileselector.cpp2
-rw-r--r--src/qml/qml/qqmlfileselector_p.h2
-rw-r--r--src/qml/qml/qqmltypeloader.cpp2
-rw-r--r--src/qml/qml/qqmltypeloader_p.h2
-rw-r--r--src/quick/items/qquickshadereffectsource.cpp15
-rw-r--r--src/quick/items/qquickshadereffectsource_p.h1
-rw-r--r--src/quick/items/qquickwindowmodule.cpp2
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp53
-rw-r--r--src/quick/util/qquickpixmapcache.cpp11
17 files changed, 67 insertions, 48 deletions
diff --git a/src/imports/dialogs-private/qmldir b/src/imports/dialogs-private/qmldir
index e184715519..c371f8bb8c 100644
--- a/src/imports/dialogs-private/qmldir
+++ b/src/imports/dialogs-private/qmldir
@@ -1,3 +1,4 @@
module QtQuick.Dialogs.Private
plugin dialogsprivateplugin
typeinfo plugins.qmltypes
+classname QtQuick2DialogsPrivatePlugin
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index 2383709b4f..6633435668 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -284,8 +284,13 @@ bool JsonParser::parseMember(ObjectRef o)
return false;
ScopedString s(scope, context->engine->newIdentifier(key));
- Property *p = o->insertMember(s, Attr_Data);
- p->value = val.asReturnedValue();
+ uint idx = s->asArrayIndex();
+ if (idx < UINT_MAX) {
+ o->putIndexed(idx, val);
+ } else {
+ Property *p = o->insertMember(s, Attr_Data);
+ p->value = val.asReturnedValue();
+ }
END;
return true;
diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri
index f969f5c644..3bba6f8e83 100644
--- a/src/qml/qml/qml.pri
+++ b/src/qml/qml/qml.pri
@@ -126,7 +126,7 @@ HEADERS += \
$$PWD/qqmlplatform_p.h \
$$PWD/qqmlbinding_p.h \
$$PWD/qqmlextensionplugin_p.h \
- $$PWD/qqmlabstracturlinterceptor_p.h \
+ $$PWD/qqmlabstracturlinterceptor.h \
$$PWD/qqmlapplicationengine_p.h \
$$PWD/qqmlapplicationengine.h \
$$PWD/qqmllistwrapper_p.h \
diff --git a/src/qml/qml/qqmlabstracturlinterceptor.cpp b/src/qml/qml/qqmlabstracturlinterceptor.cpp
index 321698ad8e..127dad86ce 100644
--- a/src/qml/qml/qqmlabstracturlinterceptor.cpp
+++ b/src/qml/qml/qqmlabstracturlinterceptor.cpp
@@ -44,9 +44,6 @@
\inmodule QtQml
\brief allows you to control QML file loading.
- \note This class is not currently public API, due to the risk of being affected
- by planned engine changes in upcoming releases.
-
QQmlAbstractUrlInterceptor is an interface which can be used to alter URLs
before they are used by the QML engine. This is primarily useful for altering
file urls into other file urls, such as selecting different graphical assets
diff --git a/src/qml/qml/qqmlabstracturlinterceptor_p.h b/src/qml/qml/qqmlabstracturlinterceptor.h
index 471c837eed..4bcaa89b4a 100644
--- a/src/qml/qml/qqmlabstracturlinterceptor_p.h
+++ b/src/qml/qml/qqmlabstracturlinterceptor.h
@@ -43,11 +43,11 @@
#define QQMLABSTRACTURLINTERCEPTOR_H
#include <QtCore/qurl.h>
-#include <private/qtqmlglobal_p.h>
+#include <QtQml/qtqmlglobal.h>
QT_BEGIN_NAMESPACE
-class Q_QML_PRIVATE_EXPORT QQmlAbstractUrlInterceptor
+class Q_QML_EXPORT QQmlAbstractUrlInterceptor
{
Q_FLAGS(InterceptionPoint)
public:
diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp
index 1e5f6bfa34..2e208f2f3b 100644
--- a/src/qml/qml/qqmlcompiler.cpp
+++ b/src/qml/qml/qqmlcompiler.cpp
@@ -61,7 +61,7 @@
#include "qqmlscriptstring.h"
#include "qqmlglobal_p.h"
#include "qqmlbinding_p.h"
-#include "qqmlabstracturlinterceptor_p.h"
+#include "qqmlabstracturlinterceptor.h"
#include <QDebug>
#include <QPointF>
diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp
index 7731935b75..78e6650d02 100644
--- a/src/qml/qml/qqmlcontext.cpp
+++ b/src/qml/qml/qqmlcontext.cpp
@@ -48,7 +48,7 @@
#include "qqmlengine_p.h"
#include "qqmlengine.h"
#include "qqmlinfo.h"
-#include "qqmlabstracturlinterceptor_p.h"
+#include "qqmlabstracturlinterceptor.h"
#include <qjsengine.h>
#include <QtCore/qvarlengtharray.h>
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 83ed627339..f8e5ad5874 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -66,7 +66,7 @@
#include <private/qv4debugservice_p.h>
#include <private/qdebugmessageservice_p.h>
#include "qqmlincubator.h"
-#include "qqmlabstracturlinterceptor_p.h"
+#include "qqmlabstracturlinterceptor.h"
#include <private/qv8profilerservice_p.h>
#include <private/qqmlboundsignal_p.h>
diff --git a/src/qml/qml/qqmlfileselector.cpp b/src/qml/qml/qqmlfileselector.cpp
index 7f2007ec00..6ddc2eb2ff 100644
--- a/src/qml/qml/qqmlfileselector.cpp
+++ b/src/qml/qml/qqmlfileselector.cpp
@@ -40,10 +40,10 @@
****************************************************************************/
#include <QtCore/QFileSelector>
+#include <QtQml/QQmlAbstractUrlInterceptor>
#include <qobjectdefs.h>
#include "qqmlfileselector.h"
#include "qqmlfileselector_p.h"
-#include "qqmlabstracturlinterceptor_p.h"
#include <QDebug>
QT_BEGIN_NAMESPACE
diff --git a/src/qml/qml/qqmlfileselector_p.h b/src/qml/qml/qqmlfileselector_p.h
index fe3679e08d..501f563ade 100644
--- a/src/qml/qml/qqmlfileselector_p.h
+++ b/src/qml/qml/qqmlfileselector_p.h
@@ -54,8 +54,8 @@
//
#include "qqmlfileselector.h"
-#include "qqmlabstracturlinterceptor_p.h"
#include <QSet>
+#include <QQmlAbstractUrlInterceptor>
#include <private/qobject_p.h>
#include <private/qtqmlglobal_p.h>
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index c9694da0df..6eda55e35b 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
#include "qqmltypeloader_p.h"
-#include "qqmlabstracturlinterceptor_p.h"
+#include "qqmlabstracturlinterceptor.h"
#include "qqmlcontextwrapper_p.h"
#include "qqmlexpression_p.h"
diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h
index c9a5edc39e..b93cf2942d 100644
--- a/src/qml/qml/qqmltypeloader_p.h
+++ b/src/qml/qml/qqmltypeloader_p.h
@@ -59,6 +59,7 @@
#include <QtQml/qqmlerror.h>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlfile.h>
+#include <QtQml/qqmlabstracturlinterceptor.h>
#include <private/qhashedstring_p.h>
#include <private/qqmlscript_p.h>
@@ -67,7 +68,6 @@
#include <private/qqmldirparser_p.h>
#include <private/qqmlbundle_p.h>
#include <private/qflagpointer_p.h>
-#include <private/qqmlabstracturlinterceptor_p.h>
#include <private/qv4value_p.h>
#include <private/qv4script_p.h>
diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp
index e076a342df..98203c51e5 100644
--- a/src/quick/items/qquickshadereffectsource.cpp
+++ b/src/quick/items/qquickshadereffectsource.cpp
@@ -158,16 +158,24 @@ QQuickShaderEffectTexture::QQuickShaderEffectTexture(QQuickItem *shaderSource)
QQuickShaderEffectTexture::~QQuickShaderEffectTexture()
{
- if (m_renderer)
- disconnect(m_renderer, SIGNAL(sceneGraphChanged()), this, SLOT(markDirtyTexture()));
+ invalidated();
+}
+
+void QQuickShaderEffectTexture::invalidated()
+{
delete m_renderer;
+ m_renderer = 0;
delete m_fbo;
delete m_secondaryFbo;
+ m_fbo = m_secondaryFbo = 0;
#ifdef QSG_DEBUG_FBO_OVERLAY
delete m_debugOverlay;
+ m_debugOverlay = 0;
#endif
- if (m_transparentTexture)
+ if (m_transparentTexture) {
glDeleteTextures(1, &m_transparentTexture);
+ m_transparentTexture = 0;
+ }
}
int QQuickShaderEffectTexture::textureId() const
@@ -609,6 +617,7 @@ void QQuickShaderEffectSource::ensureTexture()
"Cannot be used outside the rendering thread");
m_texture = new QQuickShaderEffectTexture(this);
+ connect(QQuickItemPrivate::get(this)->window, SIGNAL(sceneGraphInvalidated()), m_texture, SLOT(invalidated()), Qt::DirectConnection);
connect(m_texture, SIGNAL(updateRequested()), this, SLOT(update()));
connect(m_texture, SIGNAL(scheduledUpdateCompleted()), this, SIGNAL(scheduledUpdateCompleted()));
}
diff --git a/src/quick/items/qquickshadereffectsource_p.h b/src/quick/items/qquickshadereffectsource_p.h
index 6218775700..efa963fe64 100644
--- a/src/quick/items/qquickshadereffectsource_p.h
+++ b/src/quick/items/qquickshadereffectsource_p.h
@@ -124,6 +124,7 @@ Q_SIGNALS:
public Q_SLOTS:
void markDirtyTexture();
+ void invalidated();
private:
void grab();
diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp
index cd1b68991d..44a4bf3db6 100644
--- a/src/quick/items/qquickwindowmodule.cpp
+++ b/src/quick/items/qquickwindowmodule.cpp
@@ -82,7 +82,7 @@ public:
if (!m_complete)
m_visibility = visibility;
else
- QQuickWindow::setVisibility(m_visibility);
+ QQuickWindow::setVisibility(visibility);
}
Q_SIGNALS:
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 6c27cb68c7..d779285a44 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -48,6 +48,7 @@
#include <QtGui/QGuiApplication>
#include <QtGui/QScreen>
+#include <QtGui/QOffscreenSurface>
#include <QtQuick/QQuickWindow>
#include <private/qquickwindow_p.h>
@@ -205,12 +206,14 @@ public:
class WMTryReleaseEvent : public WMWindowEvent
{
public:
- WMTryReleaseEvent(QQuickWindow *win, bool destroy)
+ WMTryReleaseEvent(QQuickWindow *win, bool destroy, QOffscreenSurface *fallback)
: WMWindowEvent(win, WM_TryRelease)
, inDestructor(destroy)
+ , fallbackSurface(fallback)
{}
bool inDestructor;
+ QOffscreenSurface *fallbackSurface;
};
class WMExposeEvent : public WMWindowEvent
@@ -295,7 +298,7 @@ public:
delete sgrc;
}
- void invalidateOpenGL(QQuickWindow *window, bool inDestructor);
+ void invalidateOpenGL(QQuickWindow *window, bool inDestructor, QOffscreenSurface *backupSurface);
void initializeOpenGL();
bool event(QEvent *);
@@ -362,17 +365,9 @@ bool QSGRenderThread::event(QEvent *e)
case WM_Expose: {
QSG_RT_DEBUG("WM_Expose");
WMExposeEvent *se = static_cast<WMExposeEvent *>(e);
-
- pendingUpdate |= RepaintRequest;
-
Q_ASSERT(!window || window == se->window);
-
+ pendingUpdate |= RepaintRequest;
windowSize = se->size;
- if (window) {
- QSG_RT_DEBUG(" - window already added...");
- return true;
- }
-
window = se->window;
return true; }
@@ -383,7 +378,7 @@ bool QSGRenderThread::event(QEvent *e)
mutex.lock();
if (window) {
- QSG_RT_DEBUG(" - removed one...");
+ QSG_RT_DEBUG(" - removed window...");
window = 0;
}
waitCondition.wakeOne();
@@ -406,7 +401,7 @@ bool QSGRenderThread::event(QEvent *e)
WMTryReleaseEvent *wme = static_cast<WMTryReleaseEvent *>(e);
if (!window || wme->inDestructor) {
QSG_RT_DEBUG(" - setting exit flag and invalidating GL");
- invalidateOpenGL(wme->window, wme->inDestructor);
+ invalidateOpenGL(wme->window, wme->inDestructor, wme->fallbackSurface);
active = gl;
if (sleeping)
stopEventProcessing = true;
@@ -455,7 +450,7 @@ bool QSGRenderThread::event(QEvent *e)
return QThread::event(e);
}
-void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor)
+void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor, QOffscreenSurface *fallback)
{
QSG_RT_DEBUG("invalidateOpenGL()");
@@ -471,7 +466,13 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor)
bool wipeSG = inDestructor || !window->isPersistentSceneGraph();
bool wipeGL = inDestructor || (wipeSG && !window->isPersistentOpenGLContext());
- gl->makeCurrent(window);
+ bool current = gl->makeCurrent(fallback ? static_cast<QSurface *>(fallback) : static_cast<QSurface *>(window));
+ if (!current) {
+#ifndef QT_NO_DEBUG
+ qWarning() << "Scene Graph failed to acquire GL context during cleanup";
+#endif
+ return;
+ }
// The canvas nodes must be cleaned up regardless if we are in the destructor..
if (wipeSG) {
@@ -479,6 +480,7 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor)
dd->cleanupNodesOnShutdown();
} else {
QSG_RT_DEBUG(" - persistent SG, avoiding cleanup");
+ gl->doneCurrent();
return;
}
@@ -512,7 +514,6 @@ void QSGRenderThread::sync()
if (windowSize.width() > 0 && windowSize.height() > 0)
current = gl->makeCurrent(window);
if (current) {
- gl->makeCurrent(window);
QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
bool hadRenderer = d->renderer != 0;
d->syncSceneGraph();
@@ -530,7 +531,6 @@ void QSGRenderThread::sync()
QSG_RT_DEBUG(" - window has bad size, waiting...");
}
- QSG_RT_DEBUG(" - window has bad size, waiting...");
waitCondition.wakeOne();
mutex.unlock();
}
@@ -1041,9 +1041,26 @@ void QSGThreadedRenderLoop::releaseResources(QQuickWindow *window, bool inDestru
w->thread->mutex.lock();
if (w->thread->isRunning() && w->thread->active) {
+
+ // The platform window might have been destroyed before
+ // hide/release/windowDestroyed is called, so we need to have a
+ // fallback surface to perform the cleanup of the scene graph
+ // and the OpenGL resources.
+ // QOffscreenSurface must be created on the GUI thread, so we
+ // create it here and pass it on to QSGRenderThread::invalidateGL()
+ QOffscreenSurface *fallback = 0;
+ if (!window->handle()) {
+ QSG_GUI_DEBUG(w->window, " - using fallback surface");
+ fallback = new QOffscreenSurface();
+ fallback->setFormat(window->requestedFormat());
+ fallback->create();
+ }
+
QSG_GUI_DEBUG(w->window, " - posting release request to render thread");
- w->thread->postEvent(new WMTryReleaseEvent(window, inDestructor));
+ w->thread->postEvent(new WMTryReleaseEvent(window, inDestructor, fallback));
w->thread->waitCondition.wait(&w->thread->mutex);
+
+ delete fallback;
}
w->thread->mutex.unlock();
}
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp
index 16ed94f91f..055d6b7e29 100644
--- a/src/quick/util/qquickpixmapcache.cpp
+++ b/src/quick/util/qquickpixmapcache.cpp
@@ -1033,17 +1033,6 @@ static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, Q
if (localFile.isEmpty())
return 0;
- // check for "retina" high-dpi and use @2x file if it exixts
- if (qApp->devicePixelRatio() > 1) {
- const int dotIndex = localFile.lastIndexOf(QLatin1Char('.'));
- if (dotIndex != -1) {
- QString retinaFile = localFile;
- retinaFile.insert(dotIndex, QStringLiteral("@2x"));
- if (QFile(retinaFile).exists())
- localFile = retinaFile;
- }
- }
-
QFile f(localFile);
QSize readSize;
QString errorString;