Merge remote-tracking branch 'origin/5.6' into 5.7

Conflicts:
	src/qmldevtools/qmldevtools.pro
	tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp

Change-Id: I12255c16716bd8a74e7047cdb1f9302a4d1ea827
This commit is contained in:
Liang Qi 2016-11-15 10:55:46 +01:00
commit 365a3ac6ae
16 changed files with 104 additions and 22 deletions

View File

@ -44,6 +44,7 @@
#include <QQuickView> //Not using QQmlApplicationEngine because many examples don't have a Window{}
#define DECLARATIVE_EXAMPLE_MAIN(NAME) int main(int argc, char* argv[]) \
{\
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);\
QGuiApplication app(argc,argv);\
app.setOrganizationName("QtProject");\
app.setOrganizationDomain("qt-project.org");\

View File

@ -3,6 +3,11 @@ TARGET = particlesplugin
TARGETPATH = QtQuick/Particles.2
IMPORT_VERSION = 2.0
greaterThan(QT_GCC_MAJOR_VERSION, 5) {
# Our code is bad. Temporary workaround. Fixed in 5.8
QMAKE_CXXFLAGS += -fno-delete-null-pointer-checks -fno-lifetime-dse
}
SOURCES += \
plugin.cpp

View File

@ -1291,14 +1291,16 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node)
// OS X 10.8.3 introduced a bug in the AMD drivers, for at least the 2011 macbook pros,
// causing point sprites who read gl_PointCoord in the frag shader to come out as
// green-red blobs.
if (perfLevel < Deformable && strstr((char *) glGetString(GL_VENDOR), "ATI")) {
const GLubyte *glVendor = QOpenGLContext::currentContext()->functions()->glGetString(GL_VENDOR);
if (perfLevel < Deformable && glVendor && strstr((char *) glVendor, "ATI")) {
perfLevel = Deformable;
}
#endif
#ifdef Q_OS_LINUX
// Nouveau drivers can potentially freeze a machine entirely when taking the point-sprite path.
if (perfLevel < Deformable && strstr((const char *) glGetString(GL_VENDOR), "nouveau"))
const GLubyte *glVendor = QOpenGLContext::currentContext()->functions()->glGetString(GL_VENDOR);
if (perfLevel < Deformable && glVendor && strstr((const char *) glVendor, "nouveau"))
perfLevel = Deformable;
#endif

View File

@ -46,6 +46,7 @@
#include "qv4stringobject_p.h"
#endif
#include <QtCore/QHash>
#include <QtCore/private/qnumeric_p.h>
using namespace QV4;
@ -63,10 +64,15 @@ static uint toArrayIndex(const QChar *ch, const QChar *end)
uint x = ch->unicode() - '0';
if (x > 9)
return UINT_MAX;
uint n = i*10 + x;
if (n < i)
// overflow
uint n;
// n = i * 10 + x, with overflow checking
if (mul_overflow(i, 10u, &n))
return UINT_MAX;
if (add_overflow(n, x, &n))
return UINT_MAX;
i = n;
++ch;
}

View File

@ -166,9 +166,9 @@ private:
void QQmlConnections::setTarget(QObject *obj)
{
Q_D(QQmlConnections);
d->targetSet = true; // even if setting to 0, it is *set*
if (d->target == obj)
if (d->targetSet && d->target == obj)
return;
d->targetSet = true; // even if setting to 0, it is *set*
foreach (QQmlBoundSignal *s, d->boundsignals) {
// It is possible that target is being changed due to one of our signal
// handlers -> use deleteLater().

View File

@ -183,6 +183,7 @@ namespace QtQuickTest
case MouseMove:
// with move event the button is NoButton, but 'buttons' holds the currently pressed buttons
me = QMouseEvent(QEvent::MouseMove, pos, window->mapToGlobal(pos), Qt::NoButton, button, stateKey);
me.setTimestamp(++lastMouseTimestamp);
break;
default:
QTEST_ASSERT(false);

View File

@ -859,7 +859,7 @@ void QQuickTextEdit::setWrapMode(WrapMode mode)
/*!
\qmlproperty int QtQuick::TextEdit::lineCount
Returns the total number of lines in the textEdit item.
Returns the total number of lines in the TextEdit item.
*/
int QQuickTextEdit::lineCount() const
{

View File

@ -3127,10 +3127,12 @@ void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item)
if (itemPriv->paintNode && itemPriv->paintNode->parent() == 0) {
QSGNode *before = qquickitem_before_paintNode(itemPriv);
if (before)
if (before && before->parent()) {
Q_ASSERT(before->parent() == itemPriv->childContainerNode());
itemPriv->childContainerNode()->insertChildNodeAfter(itemPriv->paintNode, before);
else
} else {
itemPriv->childContainerNode()->prependChildNode(itemPriv->paintNode);
}
}
} else if (itemPriv->paintNode) {
delete itemPriv->paintNode;

View File

@ -13,6 +13,11 @@ exists("qqml_enable_gcov") {
LIBS_PRIVATE += -lgcov
}
greaterThan(QT_GCC_MAJOR_VERSION, 5) {
# Our code is bad. Temporary workaround. Fixed in 5.8
QMAKE_CXXFLAGS += -fno-delete-null-pointer-checks -fno-lifetime-dse
}
QMAKE_DOCS = $$PWD/doc/qtquick.qdocconf
ANDROID_LIB_DEPENDENCIES = \

View File

@ -116,8 +116,9 @@ QSGTexture *Manager::create(const QImage &image, bool hasAlphaChannel)
if (image.width() < m_atlas_size_limit && image.height() < m_atlas_size_limit) {
if (!m_atlas)
m_atlas = new Atlas(m_atlas_size);
// t may be null for atlas allocation failure
t = m_atlas->create(image);
if (!hasAlphaChannel && t->hasAlphaChannel())
if (t && !hasAlphaChannel && t->hasAlphaChannel())
t->setHasAlphaChannel(false);
}
return t;

View File

@ -13,14 +13,3 @@
);
%deprecatedheaders = (
);
# Module dependencies.
# Every module that is required to build this module should have one entry.
# Each of the module version specifiers can take one of the following values:
# - A specific Git revision.
# - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch)
# - an empty string to use the same branch under test (dependencies will become "refs/heads/master" if we are in the master branch)
#
%dependencies = (
"qtbase" => "",
"qtxmlpatterns" => "",
);

View File

@ -1366,6 +1366,33 @@ void tst_QJSValue::hasProperty_changePrototype()
QVERIFY(obj.hasOwnProperty("foo"));
}
void tst_QJSValue::hasProperty_QTBUG56830_data()
{
QTest::addColumn<QString>("key");
QTest::addColumn<QString>("lookup");
QTest::newRow("bugreport-1") << QStringLiteral("240000000000") << QStringLiteral("3776798720");
QTest::newRow("bugreport-2") << QStringLiteral("240000000001") << QStringLiteral("3776798721");
QTest::newRow("biggest-ok-before-bug") << QStringLiteral("238609294221") << QStringLiteral("2386092941");
QTest::newRow("smallest-bugged") << QStringLiteral("238609294222") << QStringLiteral("2386092942");
QTest::newRow("biggest-bugged") << QStringLiteral("249108103166") << QStringLiteral("12884901886");
QTest::newRow("smallest-ok-after-bug") << QStringLiteral("249108103167") << QStringLiteral("12884901887");
}
void tst_QJSValue::hasProperty_QTBUG56830()
{
QFETCH(QString, key);
QFETCH(QString, lookup);
QJSEngine eng;
const QJSValue value(42);
QJSValue obj = eng.newObject();
obj.setProperty(key, value);
QVERIFY(obj.hasProperty(key));
QVERIFY(!obj.hasProperty(lookup));
}
void tst_QJSValue::deleteProperty_basic()
{
QJSEngine eng;

View File

@ -92,6 +92,8 @@ private slots:
void hasProperty_basic();
void hasProperty_globalObject();
void hasProperty_changePrototype();
void hasProperty_QTBUG56830_data();
void hasProperty_QTBUG56830();
void deleteProperty_basic();
void deleteProperty_globalObject();

View File

@ -0,0 +1,9 @@
import QtQuick 2.0
Item {
width: 50
property bool tested: false
Connections { onWidthChanged: tested = true }
}

View File

@ -52,6 +52,7 @@ private slots:
void rewriteErrors();
void singletonTypeTarget();
void enableDisable_QTBUG_36350();
void clearImplicitTarget();
private:
QQmlEngine engine;
@ -352,6 +353,32 @@ void tst_qqmlconnections::enableDisable_QTBUG_36350()
delete item;
}
//QTBUG-56499
void tst_qqmlconnections::clearImplicitTarget()
{
QQmlEngine engine;
QQmlComponent c(&engine, testFileUrl("test-connection-implicit.qml"));
QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
QVERIFY(item != 0);
// normal case: fire Connections
item->setWidth(100.);
QCOMPARE(item->property("tested").toBool(), true);
item->setProperty("tested", false);
// clear the implicit target
QQmlConnections *connections = item->findChild<QQmlConnections*>();
QVERIFY(connections);
connections->setTarget(0);
// target cleared: no longer fire Connections
item->setWidth(150.);
QCOMPARE(item->property("tested").toBool(), false);
delete item;
}
QTEST_MAIN(tst_qqmlconnections)
#include "tst_qqmlconnections.moc"

View File

@ -13,6 +13,11 @@ RESOURCES += qqmlecmascript.qrc
include (../../shared/util.pri)
greaterThan(QT_GCC_MAJOR_VERSION, 5) {
# Our code is bad. Temporary workaround. Fixed in 5.8
QMAKE_CXXFLAGS += -fno-delete-null-pointer-checks -fno-lifetime-dse
}
# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
# LIBS += -lgcov