summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorA-Team <ateam@pad.test.qt.nokia.com>2011-01-28 19:13:47 (GMT)
committerA-Team <ateam@pad.test.qt.nokia.com>2011-01-28 19:13:47 (GMT)
commitc3cdff4ea4d03e8d14f31b10a4d7e80ba0c397c2 (patch)
tree0bf5277cd8f0136172ba5675ea02a97d06c50c06
parent88b143ff819751570e83d2de601630024a9c9989 (diff)
parent5c91e32a6238fd112a7282443214c8686cda51de (diff)
downloadQt-c3cdff4ea4d03e8d14f31b10a4d7e80ba0c397c2.zip
Qt-c3cdff4ea4d03e8d14f31b10a4d7e80ba0c397c2.tar.gz
Qt-c3cdff4ea4d03e8d14f31b10a4d7e80ba0c397c2.tar.bz2
Merge branch '4.7-upstream' into 4.7-doc
-rw-r--r--examples/gestures/imagegestures/imagewidget.cpp1
-rw-r--r--src/corelib/animation/qvariantanimation.cpp13
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.cpp30
-rw-r--r--src/dbus/qdbusintegrator.cpp5
-rw-r--r--src/gui/kernel/qmacgesturerecognizer_mac.mm6
-rw-r--r--src/gui/widgets/qcombobox.cpp16
-rw-r--r--src/network/access/qnetworkaccessftpbackend.cpp4
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp4
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp6
9 files changed, 66 insertions, 19 deletions
diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp
index 12e6216..8bbb965 100644
--- a/examples/gestures/imagegestures/imagewidget.cpp
+++ b/examples/gestures/imagegestures/imagewidget.cpp
@@ -1,3 +1,4 @@
+
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp
index 212e85d..c76cb89 100644
--- a/src/corelib/animation/qvariantanimation.cpp
+++ b/src/corelib/animation/qvariantanimation.cpp
@@ -431,12 +431,17 @@ void QVariantAnimation::registerInterpolator(QVariantAnimation::Interpolator fun
{
// will override any existing interpolators
QInterpolatorVector *interpolators = registeredInterpolators();
+ // When built on solaris with GCC, the destructors can be called
+ // in such an order that we get here with interpolators == NULL,
+ // to continue causes the app to crash on exit with a SEGV
+ if (interpolators) {
#ifndef QT_NO_THREAD
- QMutexLocker locker(QMutexPool::globalInstanceGet(interpolators));
+ QMutexLocker locker(QMutexPool::globalInstanceGet(interpolators));
#endif
- if (int(interpolationType) >= interpolators->count())
- interpolators->resize(int(interpolationType) + 1);
- interpolators->replace(interpolationType, func);
+ if (int(interpolationType) >= interpolators->count())
+ interpolators->resize(int(interpolationType) + 1);
+ interpolators->replace(interpolationType, func);
+ }
}
diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp
index e79f87a..cc08f092 100644
--- a/src/corelib/kernel/qabstracteventdispatcher.cpp
+++ b/src/corelib/kernel/qabstracteventdispatcher.cpp
@@ -137,6 +137,12 @@ void QAbstractEventDispatcherPrivate::init()
// free list). As an added protection, we use the cell to store an invalid
// (negative) value that we can later check for integrity.
//
+// ABA prevention simply adds a value to 7 of the top 8 bits when resetting
+// nextFreeTimerId.
+//
+// The extra code is the bucket allocation which allows us to start with a
+// very small bucket size and grow as needed.
+//
// (continues below).
int QAbstractEventDispatcherPrivate::allocateTimerId()
{
@@ -164,6 +170,8 @@ int QAbstractEventDispatcherPrivate::allocateTimerId()
newTimerId = prepareNewValueWithSerialNumber(timerId, b[at]);
} while (!nextFreeTimerId.testAndSetRelaxed(timerId, newTimerId));
+ timerId &= TimerIdMask;
+ timerId |= b[at] & TimerSerialMask;
b[at] = -timerId;
return timerId;
@@ -174,12 +182,13 @@ int QAbstractEventDispatcherPrivate::allocateTimerId()
// X[timerId] = nextFreeTimerId;
// then we update nextFreeTimerId to the timer we've just released
//
-// The extra code in allocateTimerId and releaseTimerId are ABA prevention
-// and bucket memory. The buckets are simply to make sure we allocate only
-// the necessary number of timers. See above.
-//
// ABA prevention simply adds a value to 7 of the top 8 bits when resetting
// nextFreeTimerId.
+//
+// In addition to that, we update the same 7 bits in each entry in the bucket
+// as a counter. That way, a timer ID allocated and released will always be
+// returned with a different ID. This reduces the chances of timers being released
+// erroneously by application code.
void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId)
{
int which = timerId & TimerIdMask;
@@ -187,12 +196,21 @@ void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId)
int at = bucketIndex(bucket, which);
int *b = timerIds[bucket];
- Q_ASSERT(b[at] == -timerId);
+#ifndef QT_NO_DEBUG
+ // debug code
+ Q_ASSERT_X(timerId == -b[at], "QAbstractEventDispatcher::releaseTimerId", "Timer ID was not found, fix application");
+#else
+ if (timerId != -b[at]) {
+ // release code
+ qWarning("Timer ID %d was not found, fix application", timerId);
+ return;
+ }
+#endif
int freeId, newTimerId;
do {
freeId = nextFreeTimerId;//.loadAcquire(); // ### FIXME Proper memory ordering semantics
- b[at] = freeId & TimerIdMask;
+ b[at] = prepareNewValueWithSerialNumber(-b[at], freeId);
newTimerId = prepareNewValueWithSerialNumber(freeId, timerId);
} while (!nextFreeTimerId.testAndSetRelease(freeId, newTimerId));
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index adc3408..2e7b052 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -558,8 +558,9 @@ bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg)
switch (amsg.type()) {
case QDBusMessage::SignalMessage:
handleSignal(amsg);
- return true;
- break;
+ // if there are any other filters in this DBusConnection,
+ // let them see the signal too
+ return false;
case QDBusMessage::MethodCallMessage:
handleObjectCall(amsg);
return true;
diff --git a/src/gui/kernel/qmacgesturerecognizer_mac.mm b/src/gui/kernel/qmacgesturerecognizer_mac.mm
index 0e432f3..6a4f0bb 100644
--- a/src/gui/kernel/qmacgesturerecognizer_mac.mm
+++ b/src/gui/kernel/qmacgesturerecognizer_mac.mm
@@ -69,6 +69,7 @@ QMacSwipeGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e
case QNativeGestureEvent::Swipe: {
QSwipeGesture *g = static_cast<QSwipeGesture *>(gesture);
g->setSwipeAngle(ev->angle);
+ g->setHotSpot(ev->position);
return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
break; }
default:
@@ -110,6 +111,7 @@ QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e
g->setCenterPoint(g->startCenterPoint());
g->setChangeFlags(QPinchGesture::CenterPointChanged);
g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
+ g->setHotSpot(ev->position);
return QGestureRecognizer::MayBeGesture | QGestureRecognizer::ConsumeEventHint;
case QNativeGestureEvent::Rotate: {
g->setLastScaleFactor(g->scaleFactor());
@@ -117,6 +119,7 @@ QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e
g->setRotationAngle(g->rotationAngle() + ev->percentage);
g->setChangeFlags(QPinchGesture::RotationAngleChanged);
g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
+ g->setHotSpot(ev->position);
return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
}
case QNativeGestureEvent::Zoom:
@@ -125,6 +128,7 @@ QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e
g->setScaleFactor(g->scaleFactor() * (1 + ev->percentage));
g->setChangeFlags(QPinchGesture::ScaleFactorChanged);
g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
+ g->setHotSpot(ev->position);
return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
case QNativeGestureEvent::GestureEnd:
return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
@@ -221,6 +225,7 @@ QMacPanGestureRecognizer::recognize(QGesture *gesture, QObject *target, QEvent *
const QPointF posOffset = p - _startPos;
g->setLastOffset(g->offset());
g->setOffset(QPointF(posOffset.x(), posOffset.y()));
+ g->setHotSpot(_startPos);
return QGestureRecognizer::TriggerGesture;
}
} else if (_panTimer.isActive()) {
@@ -239,6 +244,7 @@ QMacPanGestureRecognizer::recognize(QGesture *gesture, QObject *target, QEvent *
break;
// Begin new pan session!
_startPos = QCursor::pos();
+ g->setHotSpot(_startPos);
return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
}
break; }
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 3e5f1b3..dbbf49a 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -2476,10 +2476,18 @@ void QComboBox::showPopup()
listRect.setWidth(listRect.height());
//by default popup is centered on screen in landscape
listRect.moveCenter(screen.center());
- if (staConTopRect.IsEmpty() && AknLayoutUtils::CbaLocation() != AknLayoutUtils::EAknCbaLocationBottom) {
- // landscape without stacon, menu should be at the right
- (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) :
- listRect.setLeft(screen.left());
+ if (staConTopRect.IsEmpty()) {
+ TRect cbaRect = TRect();
+ AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, cbaRect);
+ AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation();
+ switch (cbaLocation) {
+ case AknLayoutUtils::EAknCbaLocationRight:
+ listRect.setRight(screen.right());
+ break;
+ case AknLayoutUtils::EAknCbaLocationLeft:
+ listRect.setLeft(screen.left());
+ break;
+ }
}
}
#endif
diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp
index 42d2955..b0303aa 100644
--- a/src/network/access/qnetworkaccessftpbackend.cpp
+++ b/src/network/access/qnetworkaccessftpbackend.cpp
@@ -307,8 +307,10 @@ void QNetworkAccessFtpBackend::ftpDone()
// logged in successfully, send the stat requests (if supported)
QString command = url().path();
command.prepend(QLatin1String("%1 "));
- if (supportsSize)
+ if (supportsSize) {
+ ftp->rawCommand(QLatin1String("TYPE I"));
sizeId = ftp->rawCommand(command.arg(QLatin1String("SIZE"))); // get size
+ }
if (supportsMdtm)
mdtmId = ftp->rawCommand(command.arg(QLatin1String("MDTM"))); // get modified time
if (!supportsSize && !supportsMdtm)
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index c91aa54..8cff61b 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -223,7 +223,7 @@ static QString qWarnODBCHandle(int handleType, SQLHANDLE handle, int *nativeCode
state_,
&nativeCode_,
0,
- NULL,
+ 0,
&msgLen);
if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && msgLen > 0)
description_.resize(msgLen+1);
@@ -400,7 +400,7 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
// colSize-1: remove 0 termination when there is more data to fetch
int rSize = (r == SQL_SUCCESS_WITH_INFO) ? colSize : lengthIndicator/sizeof(SQLTCHAR);
fieldVal += fromSQLTCHAR(buf, rSize);
- if (lengthIndicator < (unsigned int)colSize*sizeof(SQLTCHAR)) {
+ if ((unsigned)lengthIndicator < colSize*sizeof(SQLTCHAR)) {
// workaround for Drivermanagers that don't return SQL_NO_DATA
break;
}
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index 0a7d5bf..a044c7f 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -1021,6 +1021,9 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
stmt = stmt.arg(QString::fromLatin1("pg_class.relnamespace = (select oid from "
"pg_namespace where pg_namespace.nspname = '%1') AND ").arg(schema));
break;
+ case QPSQLDriver::VersionUnknown:
+ qFatal("PSQL version is unknown");
+ break;
}
i.exec(stmt.arg(tbl));
@@ -1110,6 +1113,9 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const
stmt = stmt.arg(QString::fromLatin1("pg_class.relnamespace = (select oid from "
"pg_namespace where pg_namespace.nspname = '%1')").arg(schema));
break;
+ case QPSQLDriver::VersionUnknown:
+ qFatal("PSQL version is unknown");
+ break;
}
QSqlQuery query(createResult());