From 20b00a46fefcbfd75c6c8d758a42ad0d31ae9a84 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 18 Oct 2011 14:32:43 +0200 Subject: Fix the build for makefile build system of Symbian All includes for private headers should have private directory info. Reviewed-by: Shane Kearns --- src/gui/widgets/qlabel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp index c0be3e1..2b6eeb7 100644 --- a/src/gui/widgets/qlabel.cpp +++ b/src/gui/widgets/qlabel.cpp @@ -60,7 +60,7 @@ #endif #ifdef Q_OS_SYMBIAN -#include "qt_s60_p.h" +#include "private/qt_s60_p.h" #endif QT_BEGIN_NAMESPACE -- cgit v0.12 From b7179d6f284e277b84c54226be05832a25576387 Mon Sep 17 00:00:00 2001 From: mread Date: Tue, 18 Oct 2011 13:45:28 +0100 Subject: Fixed access to null threadData in ~QObjectPrivate If a class derived from QObjectPrivate throws an exception in its constructor, ~QObjectPrivate will be invoked with threadData being null. This change tests for null before accessing threadData. Task-number: QTBUG-4871 incidental finding Reviewed-by: Shane Kearns --- src/corelib/kernel/qobject.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 5d6e4d7..1f716bc 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -163,14 +163,15 @@ QObjectPrivate::~QObjectPrivate() { if (pendTimer) { // unregister pending timers - if (threadData->eventDispatcher) + if (threadData && threadData->eventDispatcher) threadData->eventDispatcher->unregisterTimers(q_ptr); } if (postedEvents) QCoreApplication::removePostedEvents(q_ptr, 0); - threadData->deref(); + if (threadData) + threadData->deref(); delete static_cast(metaObject); #ifdef QT_JAMBI_BUILD -- cgit v0.12 From c838a413ee15b5ee872769f914f76ed3925b2201 Mon Sep 17 00:00:00 2001 From: mread Date: Tue, 18 Oct 2011 13:51:56 +0100 Subject: Catch potential throw in ~QSymbianControl The call to topData() in ~QSymbianControl can create the required object if it does not already exist. This can then throw an exception if it fails, which is not allowed to escape the destructor. So it is caught and ignored. Task-number: QTBUG-4871 incidental finding Reviewed-by: Shane Kearns --- src/gui/kernel/qapplication_s60.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 7d198ce..f1221eb 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -584,7 +584,11 @@ QSymbianControl::~QSymbianControl() { // Ensure backing store is deleted before the top-level // window is destroyed - qt_widget_private(qwidget)->topData()->backingStore.destroy(); + QT_TRY { + qt_widget_private(qwidget)->topData()->backingStore.destroy(); + } QT_CATCH(const std::exception&) { + // ignore exceptions, nothing can be done + } if (S60->curWin == this) S60->curWin = 0; -- cgit v0.12 From c9ae5814eb40acdb683004277573a09c6b78aba9 Mon Sep 17 00:00:00 2001 From: mread Date: Tue, 18 Oct 2011 13:59:51 +0100 Subject: QS60StyleAnimation exception safety QS60StyleAnimation had a number of exception safety problems. - Exceptions from QS60StyleAnimation/V2 could panic a TRAP harness. - Pointers could be uninitialised on exception in constructor. Problems solved by switching to QScopedPointer and simplifying the code. Task-number: QTBUG-4871 incidental finding Reviewed-by: Sami Merila --- src/gui/styles/qs60style_p.h | 4 ++-- src/gui/styles/qs60style_s60.cpp | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 2fa8c7f..ad55761 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -473,8 +473,8 @@ public: private: //data members //TODO: consider changing these to non-pointers as the classes are rather small anyway - AnimationData *m_defaultData; - AnimationDataV2 *m_currentData; + QScopedPointer m_defaultData; + QScopedPointer m_currentData; }; #endif //Q_WS_S60 diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index cfb10fa..eb59115 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -132,14 +132,12 @@ AnimationDataV2::~AnimationDataV2() QS60StyleAnimation::QS60StyleAnimation(const QS60StyleEnums::SkinParts part, int frames, int interval) { - QT_TRAP_THROWING(m_defaultData = new (ELeave) AnimationData(part, frames, interval)); - QT_TRAP_THROWING(m_currentData = new (ELeave) AnimationDataV2(*m_defaultData)); + m_defaultData.reset(new AnimationData(part, frames, interval)); + m_currentData.reset(new AnimationDataV2(*m_defaultData)); } QS60StyleAnimation::~QS60StyleAnimation() { - delete m_currentData; - delete m_defaultData; } void QS60StyleAnimation::setAnimationObject(CAknBitmapAnimation* animation) @@ -152,9 +150,7 @@ void QS60StyleAnimation::setAnimationObject(CAknBitmapAnimation* animation) void QS60StyleAnimation::resetToDefaults() { - delete m_currentData; - m_currentData = 0; - QT_TRAP_THROWING(m_currentData = new (ELeave) AnimationDataV2(*m_defaultData)); + m_currentData.reset(new AnimationDataV2(*m_defaultData)); } class QS60StyleModeSpecifics -- cgit v0.12 From 72bf6105214bfc26cff33632f7f4bdeed9cdf362 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 18 Oct 2011 16:18:06 +0100 Subject: FTP - fix interoperability issues with SIZE command Certain FTP servers refuse the SIZE command in ASCII mode (proftpd) or refuse the SIZE command in ASCII mode for large files. This is a security feature, as the SIZE command requires reading the whole file and counting line ends which can cause denial of services. In binary mode, the file size on disc is reported, which is a relatively quick operation. Qt had two problems here: 1. when size command fails, the total size was reported as -1, whereas the documentation of QFtp::dataTransferProgress states it should be reported as 0 (so that QProgressDialog can display a wait note rather than progress bar) 2. SIZE command was sent before setting the type of the transfer to ASCII / Binary. This is a problem as the size reported by the server is incorrect. Also it usually means sending ASCII SIZE for Binary transfers, which results in the 550 error on FTP servers with DOS protection. Task-Number: QTTH-1428 Reviewed-By: Peter Hartmann --- src/network/access/qftp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index 50a3b1e..eccfea6 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -1851,11 +1851,11 @@ int QFtp::cd(const QString &dir) int QFtp::get(const QString &file, QIODevice *dev, TransferType type) { QStringList cmds; - cmds << QLatin1String("SIZE ") + file + QLatin1String("\r\n"); if (type == Binary) cmds << QLatin1String("TYPE I\r\n"); else cmds << QLatin1String("TYPE A\r\n"); + cmds << QLatin1String("SIZE ") + file + QLatin1String("\r\n"); cmds << QLatin1String(d_func()->transferMode == Passive ? "PASV\r\n" : "PORT\r\n"); cmds << QLatin1String("RETR ") + file + QLatin1String("\r\n"); return d_func()->addCommand(new QFtpCommand(Get, cmds, dev)); @@ -2336,7 +2336,7 @@ void QFtpPrivate::_q_piError(int errorCode, const QString &text) // non-fatal errors if (c->command == QFtp::Get && pi.currentCommand().startsWith(QLatin1String("SIZE "))) { - pi.dtp.setBytesTotal(-1); + pi.dtp.setBytesTotal(0); return; } else if (c->command==QFtp::Put && pi.currentCommand().startsWith(QLatin1String("ALLO "))) { return; -- cgit v0.12