summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-06-28 04:53:44 +1000
committerQt Continuous Integration System <qt-info@nokia.com>2011-06-28 04:53:44 +1000
commit3c67a14ad0db0e83e70b2432394f168ce279518b (patch)
tree77ba4c394f39886b21da6645723ebde9253788f2 /src
parentb39dc4a9029040f43f1ca3ace6bf7e77740a3f39 (diff)
parent007f01a7e801d5409708e4b8de8b3ead1481cf7d (diff)
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-earth-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-earth-staging: Make it compile with openssl 1.0.0d, gcc 4.6 QStringBuilder: do not crash with null char* Fix event delevery order QSocketNotifier autotest - fix compile with MSVC
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp17
-rw-r--r--src/corelib/kernel/qobject.cpp2
-rw-r--r--src/corelib/thread/qthread_p.h21
-rw-r--r--src/corelib/tools/qstringbuilder.cpp2
-rw-r--r--src/corelib/tools/qstringbuilder.h2
-rw-r--r--src/gui/kernel/qapplication.cpp4
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp4
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp4
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols_p.h4
9 files changed, 42 insertions, 18 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index dd46bc5603..18a5eae85a 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1288,20 +1288,7 @@ void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority)
// delete the event on exceptions to protect against memory leaks till the event is
// properly owned in the postEventList
QScopedPointer<QEvent> eventDeleter(event);
- if (data->postEventList.isEmpty() || data->postEventList.last().priority >= priority) {
- // optimization: we can simply append if the last event in
- // the queue has higher or equal priority
- data->postEventList.append(QPostEvent(receiver, event, priority));
- } else {
- // insert event in descending priority order, using upper
- // bound for a given priority (to ensure proper ordering
- // of events with the same priority)
- QPostEventList::iterator begin = data->postEventList.begin()
- + data->postEventList.insertionOffset,
- end = data->postEventList.end();
- QPostEventList::iterator at = qUpperBound(begin, end, priority);
- data->postEventList.insert(at, QPostEvent(receiver, event, priority));
- }
+ data->postEventList.addEvent(QPostEvent(receiver, event, priority));
eventDeleter.take();
event->posted = true;
++receiver->d_func()->postedEvents;
@@ -1461,7 +1448,7 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type
// cannot send deferred delete
if (!event_type && !receiver) {
// don't lose the event
- data->postEventList.append(pe);
+ data->postEventList.addEvent(pe);
const_cast<QPostEvent &>(pe).event = 0;
}
continue;
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index b88643df5c..88618c3c87 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -1482,7 +1482,7 @@ void QObjectPrivate::setThreadData_helper(QThreadData *currentData, QThreadData
continue;
if (pe.receiver == q) {
// move this post event to the targetList
- targetData->postEventList.append(pe);
+ targetData->postEventList.addEvent(pe);
const_cast<QPostEvent &>(pe).event = 0;
++eventsMoved;
}
diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h
index 13df3e6fea..461d93dd50 100644
--- a/src/corelib/thread/qthread_p.h
+++ b/src/corelib/thread/qthread_p.h
@@ -93,6 +93,8 @@ inline bool operator<(const QPostEvent &pe, int priority)
return priority < pe.priority;
}
+// This class holds the list of posted events.
+// The list has to be kept sorted by priority
class QPostEventList : public QList<QPostEvent>
{
public:
@@ -109,6 +111,25 @@ public:
inline QPostEventList()
: QList<QPostEvent>(), recursion(0), startOffset(0), insertionOffset(0)
{ }
+
+ void addEvent(const QPostEvent &ev) {
+ int priority = ev.priority;
+ if (isEmpty() || last().priority >= priority) {
+ // optimization: we can simply append if the last event in
+ // the queue has higher or equal priority
+ append(ev);
+ } else {
+ // insert event in descending priority order, using upper
+ // bound for a given priority (to ensure proper ordering
+ // of events with the same priority)
+ QPostEventList::iterator at = qUpperBound(begin() + insertionOffset, end(), priority);
+ insert(at, ev);
+ }
+ }
+private:
+ //hides because they do not keep that list sorted. addEvent must be used
+ using QList<QPostEvent>::append;
+ using QList<QPostEvent>::insert;
};
#ifndef QT_NO_THREAD
diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp
index 45de6bc1c3..1cc7e5d2c3 100644
--- a/src/corelib/tools/qstringbuilder.cpp
+++ b/src/corelib/tools/qstringbuilder.cpp
@@ -162,6 +162,8 @@ void QAbstractConcatenable::convertFromAscii(const char *a, int len, QChar *&out
}
#endif
if (len == -1) {
+ if (!a)
+ return;
while (*a)
*out++ = QLatin1Char(*a++);
} else {
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index 709d84a578..594ab2f183 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -352,6 +352,8 @@ template <> struct QConcatenable<const char *> : private QAbstractConcatenable
#endif
static inline void appendTo(const char *a, char *&out)
{
+ if (!a)
+ return;
while (*a)
*out++ = *a++;
}
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 38035997fe..361ec6ddec 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -1288,8 +1288,8 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
|| event->type() == QEvent::LanguageChange
|| event->type() == QEvent::UpdateSoftKeys
|| event->type() == QEvent::InputMethod)) {
- for (int i = 0; i < postedEvents->size(); ++i) {
- const QPostEvent &cur = postedEvents->at(i);
+ for (QPostEventList::const_iterator it = postedEvents->constBegin(); it != postedEvents->constEnd(); ++it) {
+ const QPostEvent &cur = *it;
if (cur.receiver != receiver || cur.event == 0 || cur.event->type() != event->type())
continue;
if (cur.event->type() == QEvent::LayoutRequest
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 9a137a62b2..5a606af0ca 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -420,7 +420,11 @@ init_context:
QByteArray ace = QUrl::toAce(tlsHostName);
// only send the SNI header if the URL is valid and not an IP
if (!ace.isEmpty() && !QHostAddress().setAddress(tlsHostName)) {
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+ if (!q_SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_HOSTNAME, TLSEXT_NAMETYPE_host_name, ace.data()))
+#else
if (!q_SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_HOSTNAME, TLSEXT_NAMETYPE_host_name, ace.constData()))
+#endif
qWarning("could not set SSL_CTRL_SET_TLSEXT_HOSTNAME, Server Name Indication disabled");
}
}
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index a4cc3c493d..90a840f124 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -210,8 +210,12 @@ DEFINEFUNC(int, SSL_library_init, void, DUMMYARG, return -1, return)
DEFINEFUNC(void, SSL_load_error_strings, void, DUMMYARG, return, DUMMYARG)
DEFINEFUNC(SSL *, SSL_new, SSL_CTX *a, a, return 0, return)
#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT)
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+DEFINEFUNC4(long, SSL_ctrl, SSL *a, a, int cmd, cmd, long larg, larg, void *parg, parg, return -1, return)
+#else
DEFINEFUNC4(long, SSL_ctrl, SSL *a, a, int cmd, cmd, long larg, larg, const void *parg, parg, return -1, return)
#endif
+#endif
DEFINEFUNC3(int, SSL_read, SSL *a, a, void *b, b, int c, c, return -1, return)
DEFINEFUNC3(void, SSL_set_bio, SSL *a, a, BIO *b, b, BIO *c, c, return, DUMMYARG)
DEFINEFUNC(void, SSL_set_accept_state, SSL *a, a, return, DUMMYARG)
diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h
index c0a3b4da6a..0381c4f2b6 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h
+++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h
@@ -318,8 +318,12 @@ int q_SSL_library_init();
void q_SSL_load_error_strings();
SSL *q_SSL_new(SSL_CTX *a);
#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT)
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+long q_SSL_ctrl(SSL *ssl,int cmd, long larg, void *parg);
+#else
long q_SSL_ctrl(SSL *ssl,int cmd, long larg, const void *parg);
#endif
+#endif
int q_SSL_read(SSL *a, void *b, int c);
void q_SSL_set_bio(SSL *a, BIO *b, BIO *c);
void q_SSL_set_accept_state(SSL *a);