From ddd1e4aefcb8e52125656588b0bb76ec246b5d29 Mon Sep 17 00:00:00 2001 From: Bill King Date: Wed, 7 Apr 2010 15:42:36 +1000 Subject: Fix test sql for sql server. Sql server requires explicitly setting fields to be nullable. --- tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index 8a084bb..38e5387 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -181,7 +181,11 @@ void tst_QSqlTableModel::createTestTables() QVERIFY_SQL( q, exec("create table " + test3 + "(id int, random varchar(20), randomtwo varchar(20))")); - QVERIFY_SQL( q, exec("create table " + qTableName("test4", __FILE__) + "(column1 varchar(50), column2 varchar(50), column3 varchar(50))")); + if(!tst_Databases::isSqlServer(db)) + QVERIFY_SQL( q, exec("create table " + qTableName("test4", __FILE__) + "(column1 varchar(50), column2 varchar(50), column3 varchar(50))")); + else + QVERIFY_SQL( q, exec("create table " + qTableName("test4", __FILE__) + "(column1 varchar(50), column2 varchar(50) NULL, column3 varchar(50))")); + QVERIFY_SQL( q, exec("create table " + qTableName("emptytable", __FILE__) + "(id int)")); -- cgit v0.12 From 0102ee1de421a26a8bfd853146e485c3686baef6 Mon Sep 17 00:00:00 2001 From: Stefano Pironato Date: Mon, 29 Mar 2010 15:56:27 +0300 Subject: Fix valgrind report shows memory leak for QImage::save(). Reviewed-by: Marius Storm-Olsen --- src/gui/image/qimagewriter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index a5f7b31..503a1b2 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -197,6 +197,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, for (int i = 0; i < keys.size(); ++i) { QImageIOPlugin *plugin = qobject_cast(l->instance(keys.at(i))); if (plugin && (plugin->capabilities(device, testFormat) & QImageIOPlugin::CanWrite)) { + delete handler; handler = plugin->create(device, testFormat); break; } -- cgit v0.12 From 71df6edab122730c38ac238e168a4cc35b6f4857 Mon Sep 17 00:00:00 2001 From: mread Date: Tue, 6 Apr 2010 14:05:01 +0100 Subject: QTBUG-4887 and other exception safety fixes This change includes a fix for QTBUG-4887 and other exception safety problems found while testing it. The QTBUG-4887 fix is to qimage.cpp. QImage doesn't throw exceptions on failure like a proper class should, instead it tries to fail "nice". What happens here is that setAlphaChannel would crash on OOM as after the convertToFormat call, d could be NULL. This new version checks the result of the conversion before using it. The other fixes are all cases where exceptions were thrown from destructors. I added code to the test app to help debug these cases, and I fixed all the problems I found. With these changes, tst_exceptionsafety_objects runs and passes on the Symbian emulator. Reviewed-by: Shane Kearns --- src/gui/image/qimage.cpp | 6 +++++- src/gui/kernel/qapplication_s60.cpp | 9 +++++++-- src/gui/kernel/qwidget.cpp | 8 ++++++-- src/gui/widgets/qmenu.cpp | 14 ++++++++------ .../tst_exceptionsafety_objects.cpp | 19 +++++++++++++++++++ 5 files changed, 45 insertions(+), 11 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 4f5efa1..5d2b4c0 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -5667,7 +5667,11 @@ void QImage::setAlphaChannel(const QImage &alphaChannel) detach(); - *this = convertToFormat(QImage::Format_ARGB32_Premultiplied); + QImage converted = convertToFormat(QImage::Format_ARGB32_Premultiplied); + if (!converted.isNull()) + *this = converted; + else + return; // Slight optimization since alphachannels are returned as 8-bit grays. if (alphaChannel.d->depth == 8 && alphaChannel.isGrayscale()) { diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 37d1b62..e986ce9 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -372,8 +372,13 @@ QSymbianControl::~QSymbianControl() { if (S60->curWin == this) S60->curWin = 0; - if (!QApplicationPrivate::is_app_closing) - setFocusSafely(false); + if (!QApplicationPrivate::is_app_closing) { + QT_TRY { + setFocusSafely(false); + } QT_CATCH(const std::exception&) { + // ignore exceptions, nothing can be done + } + } S60->appUi()->RemoveFromStack(this); delete m_longTapDetector; } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index cd943cd..e180001 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1487,8 +1487,12 @@ QWidget::~QWidget() if (QWidgetPrivate::allWidgets) // might have been deleted by ~QApplication QWidgetPrivate::allWidgets->remove(this); - QEvent e(QEvent::Destroy); - QCoreApplication::sendEvent(this, &e); + QT_TRY { + QEvent e(QEvent::Destroy); + QCoreApplication::sendEvent(this, &e); + } QT_CATCH(const std::exception&) { + // if this fails we can't do anything about it but at least we are not allowed to throw. + } } int QWidgetPrivate::instanceCounter = 0; // Current number of widget instances diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index a9978f9..c7573bf 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -1406,12 +1406,14 @@ QMenu::QMenu(QMenuPrivate &dd, QWidget *parent) QMenu::~QMenu() { Q_D(QMenu); - QHash::iterator it = d->widgetItems.begin(); - for (; it != d->widgetItems.end(); ++it) { - if (QWidget *widget = it.value()) { - QWidgetAction *action = static_cast(it.key()); - action->releaseWidget(widget); - *it = 0; + if (!d->widgetItems.isEmpty()) { // avoid detach on shared null hash + QHash::iterator it = d->widgetItems.begin(); + for (; it != d->widgetItems.end(); ++it) { + if (QWidget *widget = it.value()) { + QWidgetAction *action = static_cast(it.key()); + action->releaseWidget(widget); + *it = 0; + } } } diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp index 4433c7a..91d1a44 100644 --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp @@ -43,6 +43,7 @@ #include #include +#include QT_USE_NAMESPACE @@ -285,8 +286,26 @@ void tst_ExceptionSafetyObjects::safeMessageHandler(QtMsgType type, const char * allocFailer.reactivateAt(currentIndex); } +typedef void (*PVF)(); +PVF defaultTerminate; +void debugTerminate() +{ + // you can detect uncaught exceptions with a breakpoint in here + (*defaultTerminate)(); +} + +PVF defaultUnexpected; +void debugUnexpected() +{ + // you can detect unexpected exceptions with a breakpoint in here + (*defaultUnexpected)(); +} + void tst_ExceptionSafetyObjects::initTestCase() { + // set handlers for bad exception cases, you might want to step in and breakpoint the default handlers too + defaultTerminate = std::set_terminate(&debugTerminate); + defaultUnexpected = std::set_unexpected(&debugUnexpected); testMessageHandler = qInstallMsgHandler(safeMessageHandler); QVERIFY(AllocFailer::initialize()); -- cgit v0.12 From 7be934e98dd75d2c8902df4e88e2a1aceab9789f Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Tue, 6 Apr 2010 14:38:47 +0200 Subject: Fixes painting artifacts when scaling a QGraphicsProxyWidget. Incorrect simple conversion of the exposed rect from QRectF to QRect when rendering the widget. Task-number: QTBUG-7296 Reviewed-by: bnilsen --- src/gui/graphicsview/qgraphicsproxywidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index 483eb62..2132526 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -1435,7 +1435,7 @@ void QGraphicsProxyWidget::paint(QPainter *painter, const QStyleOptionGraphicsIt return; // Filter out repaints on the window frame. - const QRect exposedWidgetRect = (option->exposedRect & rect()).toRect(); + const QRect exposedWidgetRect = (option->exposedRect & rect()).toAlignedRect(); if (exposedWidgetRect.isEmpty()) return; -- cgit v0.12 From 2883580a3e10df16789ba1c9ee67507e508b95c1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 7 Apr 2010 13:44:20 +0200 Subject: QTableView: fix spans corruption when removing spans. - We should not do -1 after erasing, as it is done later on. - We should consider the 0 height even if it is not the last span. - Added an assert. Task-number: QTBUG-9631 Reviewed-by: Gabriel --- src/gui/itemviews/qtableview.cpp | 9 ++++----- tests/auto/qtableview/tst_qtableview.cpp | 8 ++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index c824a8a..c4d1317 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -114,15 +114,14 @@ void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height) } } else if (old_height > span->height()) { //remove the span from all the subspans lists that intersect the columns not covered anymore - Index::iterator it_y = index.lowerBound(-span->bottom()); - if (it_y == index.end()) - it_y = index.find(-span->top()); // This is the only span remaining and we are deleting it. + Index::iterator it_y = index.lowerBound(-qMax(span->bottom(), span->top())); //qMax usefull if height is 0 Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list while (-it_y.key() <= span->top() + old_height -1) { if (-it_y.key() > span->bottom()) { - (*it_y).remove(-span->left()); + int removed = (*it_y).remove(-span->left()); + Q_ASSERT(removed == 1); Q_UNUSED(removed); if (it_y->isEmpty()) { - it_y = index.erase(it_y) - 1; + it_y = index.erase(it_y); } } if(it_y == index.begin()) diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index 54e32218..2062e8e 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -3035,6 +3035,14 @@ void tst_QTableView::spans_data() << QPoint(0, 0) << 1 << 1; + + QTest::newRow("QTBUG-9631: remove one span") + << 10 << 10 + << (SpanList() << QRect(1, 1, 2, 1) << QRect(2, 2, 2, 2) << QRect(1, 1, 1, 1)) + << false + << QPoint(1, 1) + << 1 + << 1; } void tst_QTableView::spans() -- cgit v0.12 From 4c23dd7e310c2af7dc7bf351eade0bd6d528561e Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Wed, 7 Apr 2010 13:36:02 +0200 Subject: Fixes CursorChange and TooltipChange events delivery for QGraphicsWidget As the documentation mentions, these two events are delivered respectively after the cursor has changed and after the tooltip has changed. These two events were previously delivered just before. This patch is needed for fixing QTBUG-5349 even if it is not directly related. Auto-test included. Reviewed-by: bnilsen --- src/gui/graphicsview/qgraphicswidget.cpp | 4 +- tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 86 ++++++++++++++++++++++ 2 files changed, 88 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 4c5cffa..8b80bc8 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -1067,13 +1067,13 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant & QApplication::sendEvent(this, &event); break; } - case ItemCursorChange: { + case ItemCursorHasChanged: { // Deliver CursorChange. QEvent event(QEvent::CursorChange); QApplication::sendEvent(this, &event); break; } - case ItemToolTipChange: { + case ItemToolTipHasChanged: { // Deliver ToolTipChange. QEvent event(QEvent::ToolTipChange); QApplication::sendEvent(this, &event); diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 4a874be..1930a6f 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -165,6 +165,7 @@ private slots: void polishEvent2(); void initialShow(); void initialShow2(); + void itemChangeEvents(); // Task fixes void task236127_bspTreeIndexFails(); @@ -2886,6 +2887,91 @@ void tst_QGraphicsWidget::initialShow2() QTRY_COMPARE(widget->repaints, expectedRepaintCount); } +void tst_QGraphicsWidget::itemChangeEvents() +{ + class TestGraphicsWidget : public QGraphicsWidget + { public: + TestGraphicsWidget() : QGraphicsWidget() {} + QHash valueDuringEvents; + bool event(QEvent *event) { + Q_UNUSED(event); + switch (event->type()) { + case QEvent::EnabledChange: { + valueDuringEvents.insert(QEvent::EnabledChange, isEnabled()); + break; + } + case QEvent::ParentAboutToChange: { + valueDuringEvents.insert(QEvent::ParentAboutToChange, qVariantFromValue(parentItem())); + break; + } + case QEvent::ParentChange: { + valueDuringEvents.insert(QEvent::ParentChange, qVariantFromValue(parentItem())); + break; + } + case QEvent::CursorChange: { + valueDuringEvents.insert(QEvent::CursorChange, int(cursor().shape())); + break; + } + case QEvent::ToolTipChange: { + valueDuringEvents.insert(QEvent::ToolTipChange, toolTip()); + break; + } + default: { + break; + } + } + return true; + } + void showEvent(QShowEvent *event) { + Q_UNUSED(event); + valueDuringEvents.insert(QEvent::Show, isVisible()); + } + void hideEvent(QHideEvent *event) { + Q_UNUSED(event); + valueDuringEvents.insert(QEvent::Hide, isVisible()); + } + }; + + QGraphicsScene scene; + QGraphicsView view(&scene); + QGraphicsWidget *parent = new QGraphicsWidget; + scene.addItem(parent); + view.show(); + QTest::qWaitForWindowShown(&view); + + TestGraphicsWidget *item = new TestGraphicsWidget; + item->setParentItem(parent); + // ParentAboutToChange should be triggered before the parent has changed + QTRY_COMPARE(qVariantValue(item->valueDuringEvents.value(QEvent::ParentAboutToChange)), + static_cast(0)); + // ParentChange should be triggered after the parent has changed + QTRY_COMPARE(qVariantValue(item->valueDuringEvents.value(QEvent::ParentChange)), + static_cast(parent)); + + // ShowEvent should be triggered before the item is shown + QTRY_VERIFY(!item->valueDuringEvents.value(QEvent::Show).toBool()); + + // HideEvent should be triggered after the item is hidden + QVERIFY(item->isVisible()); + item->setVisible(false); + QVERIFY(!item->isVisible()); + QTRY_VERIFY(!item->valueDuringEvents.value(QEvent::Hide).toBool()); + + // CursorChange should be triggered after the cursor has changed + item->setCursor(Qt::PointingHandCursor); + QTRY_COMPARE(item->valueDuringEvents.value(QEvent::CursorChange).toInt(), int(item->cursor().shape())); + + // ToolTipChange should be triggered after the tooltip has changed + item->setToolTip("tooltipText"); + QTRY_COMPARE(item->valueDuringEvents.value(QEvent::ToolTipChange).toString(), item->toolTip()); + + // EnabledChange should be triggered after the enabled state has changed + QVERIFY(item->isEnabled()); + item->setEnabled(false); + QVERIFY(!item->isEnabled()); + QTRY_VERIFY(!item->valueDuringEvents.value(QEvent::EnabledChange).toBool()); +} + void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems() { QGraphicsScene scene; -- cgit v0.12 From a6e182f7a91b2dd9371e7b16f2553430cbae4509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 7 Apr 2010 16:21:57 +0200 Subject: Fixed caching of QPainter patterns in the GL 2 engine. The patterns all got the same cache key (e.g. 1), which caused the patterns to be uploaded as a texture every single time they were used. Reviewed-by: Kim --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 2b8e097..828849d 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -184,7 +184,7 @@ void QGL2PaintEngineExPrivate::updateBrushTexture() QImage texImage = qt_imageForBrush(style, false); glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); - ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, true, QGLContext::InternalBindOption); + ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); } else if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) { -- cgit v0.12 From 5ae2cbe99d06e1f1d037cd9a7868f2e1fd3f4c4c Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 8 Apr 2010 08:29:21 +0300 Subject: Fixed focus and window activation events on Symbian when opening menu. As described in QTBUG-8698, Qt for Symbian has been generating incorrect focus and window activation events. This has happened since launching menu from QSoftkeyManager with TryDisplayMenuBarL, invokes eventually QSymbianControl::FocusChanged. But when the FocusChanged is called menu being launched is not yet set to visible, meaning that IsDisplayingMenuOrDialog returns false. Because there is no way in platform to detect that menu is being launhced, the fix is to add a new flag QS60Data, which can be used to detect if FocusChanged event is received due to the fact that menu is being constructed/launched. Task-number: QTBUG-8698 * Fixes issues 2, 3 and 4 Reviewed-by: Sami Merila --- src/gui/kernel/qapplication_s60.cpp | 3 ++- src/gui/kernel/qsoftkeymanager_s60.cpp | 19 ++++++++++++++++--- src/gui/kernel/qsoftkeymanager_s60_p.h | 1 + src/gui/kernel/qt_s60_p.h | 1 + 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index e986ce9..61beb4f 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -994,7 +994,7 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) } #endif } else if (QApplication::activeWindow() == qwidget->window()) { - if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog()) { + if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) { QWidget *fw = QApplication::focusWidget(); if (fw) { QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason); @@ -1244,6 +1244,7 @@ void qt_init(QApplicationPrivate * /* priv */, int) } S60->avkonComponentsSupportTransparency = false; + S60->menuBeingConstructed = false; #ifdef Q_WS_S60 TUid KCRUidAvkon = { 0x101F876E }; diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index 7d643c2..2a9ac42 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -365,17 +365,30 @@ void QSoftKeyManagerPrivateS60::updateSoftKeys_sys() nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation } +static void resetMenuBeingConstructed(TAny* /*aAny*/) +{ + S60->menuBeingConstructed = false; +} + +void QSoftKeyManagerPrivateS60::tryDisplayMenuBarL() +{ + CleanupStack::PushL(TCleanupItem(resetMenuBeingConstructed, NULL)); + S60->menuBeingConstructed = true; + S60->menuBar()->TryDisplayMenuBarL(); + CleanupStack::PopAndDestroy(); // Reset menuBeingConstructed to false in all cases +} + bool QSoftKeyManagerPrivateS60::handleCommand(int command) { QAction *action = realSoftKeyActions.value(command); if (action) { QVariant property = action->property(MENU_ACTION_PROPERTY); if (property.isValid() && property.toBool()) { - QT_TRAP_THROWING(S60->menuBar()->TryDisplayMenuBarL()); + QT_TRAP_THROWING(tryDisplayMenuBarL()); } else if (action->menu()) { // TODO: This is hack, in order to use exising QMenuBar implementation for Symbian // menubar needs to have widget to which it is associated. Since we want to associate - // menubar to action (which is inherited from QObejct), we create and associate QWidget + // menubar to action (which is inherited from QObject), we create and associate QWidget // to action and pass that for QMenuBar. This associates the menubar to action, and we // can have own menubar for each action. QWidget *actionContainer = action->property("_q_action_widget").value(); @@ -394,7 +407,7 @@ bool QSoftKeyManagerPrivateS60::handleCommand(int command) action->setProperty("_q_action_widget", v); } qt_symbian_next_menu_from_action(actionContainer); - QT_TRAP_THROWING(S60->menuBar()->TryDisplayMenuBarL()); + QT_TRAP_THROWING(tryDisplayMenuBarL()); } else { Q_ASSERT(action->softKeyRole() != QAction::NoSoftKey); QWidget *actionParent = action->parentWidget(); diff --git a/src/gui/kernel/qsoftkeymanager_s60_p.h b/src/gui/kernel/qsoftkeymanager_s60_p.h index a5e5016..d14993c 100644 --- a/src/gui/kernel/qsoftkeymanager_s60_p.h +++ b/src/gui/kernel/qsoftkeymanager_s60_p.h @@ -78,6 +78,7 @@ public: bool handleCommand(int command); private: + void tryDisplayMenuBarL(); bool skipCbaUpdate(); void ensureCbaVisibilityAndResponsiviness(CEikButtonGroupContainer &cba); void clearSoftkeys(CEikButtonGroupContainer &cba); diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 7c6b754..a714221 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -122,6 +122,7 @@ public: int qtOwnsS60Environment : 1; int supportsPremultipliedAlpha : 1; int avkonComponentsSupportTransparency : 1; + int menuBeingConstructed : 1; QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type static inline void updateScreenSize(); static inline RWsSession& wsSession(); -- cgit v0.12 From 383c336be79c9757a51427f06aa68df0b4849e31 Mon Sep 17 00:00:00 2001 From: Janne Koskinen Date: Thu, 8 Apr 2010 13:07:27 +0300 Subject: Clear QFontCache TLS content before nullifying TLS pointer. If not cleared server handles are left open causing Font Server to Panic with KErrInUse in Symbian. Task-number: QTBUG-9565 Reviewed-by: Simon Hausmann --- src/gui/text/qfont.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index dd9e69e..a41b000 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2612,8 +2612,10 @@ void QFontCache::cleanup() } QT_CATCH (const std::bad_alloc &) { // no cache - just ignore } - if (cache && cache->hasLocalData()) + if (cache && cache->hasLocalData()) { + cache->localData()->clear(); cache->setLocalData(0); + } } #endif // QT_NO_THREAD -- cgit v0.12 From 0ef1365a07ca63b8243d8c051ebc7a8b7a7b5d5e Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Thu, 8 Apr 2010 14:44:18 +0200 Subject: Symbian emulator: unload file server so apps can be recompiled. Mentioned in the Qt S60 team developer journal, 23.05.2008. Code & investigation by Janne Anttila. Reviewed-by: Janne Koskinen --- src/corelib/kernel/qcoreapplication.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 2da5a7d..102c41e 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -67,6 +67,7 @@ #ifdef Q_OS_SYMBIAN # include # include +# include # include "qeventdispatcher_symbian_p.h" # include "private/qcore_symbian_p.h" #elif defined(Q_OS_UNIX) @@ -579,6 +580,27 @@ void QCoreApplication::init() qt_core_eval_init(d->application_type); #endif +#if defined(Q_OS_SYMBIAN) \ + && defined(Q_CC_NOKIAX86) \ + && defined(QT_DEBUG) + /** + * Prevent the executable from being locked in the Symbian emulator. The + * code dramatically simplifies debugging on Symbian, but beyond that has + * no impact. + * + * Force the ZLazyUnloadTimer to fire and therefore unload code segments + * immediately. The code affects Symbian's file server and on the other + * hand needs only to be run once in each emulator run. + */ + { + RLoader loader; + CleanupClosePushL(loader); + User::LeaveIfError(loader.Connect()); + User::LeaveIfError(loader.CancelLazyDllUnload()); + CleanupStack::PopAndDestroy(&loader); + } +#endif + qt_startup_hook(); } -- cgit v0.12 From e86eabc78e222d9c46a38940085025dea518aefa Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 8 Apr 2010 13:55:21 +0300 Subject: Generate triggered signal even the action launches menu in Symbian. Triggered signal is useful for detecting native 'Options' menu launches in Symbian. QMenu::aboutToShow event is currently also not generated, but that is part of another bug report. And QMenu::aboutToShow would not even be generated for 'Options' menu itself but only for its sub/cascade menus. Task-number: QTBUG-9669 Reviewed-by: Sami Merila --- src/gui/kernel/qsoftkeymanager_s60.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index 2a9ac42..c0761f0 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -408,14 +408,14 @@ bool QSoftKeyManagerPrivateS60::handleCommand(int command) } qt_symbian_next_menu_from_action(actionContainer); QT_TRAP_THROWING(tryDisplayMenuBarL()); - } else { - Q_ASSERT(action->softKeyRole() != QAction::NoSoftKey); - QWidget *actionParent = action->parentWidget(); - Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!"); - if (actionParent->isEnabled()) { - action->activate(QAction::Trigger); - return true; - } + } + + Q_ASSERT(action->softKeyRole() != QAction::NoSoftKey); + QWidget *actionParent = action->parentWidget(); + Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!"); + if (actionParent->isEnabled()) { + action->activate(QAction::Trigger); + return true; } } return false; -- cgit v0.12 From 3900e09478f01798b4dbcaf573426d886fd2db23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 9 Apr 2010 13:15:16 +0200 Subject: Fixed possible data corruption in the triangulating stroker. In the case where a polygon or polyline that contains consequtive equal points, we end up calculating an invalid normal vector for the joins. This fix skips past duplicate consequtive points. Task-number: QTBUG-9548 Reviewed-by: Kim --- src/opengl/gl2paintengineex/qtriangulatingstroker.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp index 5229d3f..eaa3d57 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp @@ -144,11 +144,17 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen) m_cos_theta = qFastCos(Q_PI / m_roundness); const qreal *endPts = pts + (count<<1); - const qreal *startPts; + const qreal *startPts = 0; Qt::PenCapStyle cap = m_cap_style; if (!types) { + // skip duplicate points + while((pts + 2) < endPts && pts[0] == pts[2] && pts[1] == pts[3]) + pts += 2; + if ((pts + 2) == endPts) + return; + startPts = pts; bool endsAtStart = startPts[0] == *(endPts-2) && startPts[1] == *(endPts-1); @@ -161,15 +167,17 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen) lineTo(pts); pts += 2; while (pts < endPts) { - join(pts); - lineTo(pts); + if (m_cx != pts[0] || m_cy != pts[1]) { + join(pts); + lineTo(pts); + } pts += 2; } endCapOrJoinClosed(startPts, pts-2, path.hasImplicitClose(), endsAtStart); } else { - bool endsAtStart; + bool endsAtStart = false; while (pts < endPts) { switch (*types) { case QPainterPath::MoveToElement: { -- cgit v0.12 From 385f2c8a34a52443e78dfa272a1a483b9d6d29fc Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Fri, 9 Apr 2010 13:21:32 +0200 Subject: Enable preserved swap behavior when surface is created due to resize. When the QVG_RECREATE_ON_SIZE_CHANGE macro is defined the EGL surface is recreated. However, after creating the surface, we were neglecting to set the surface attribute that enabled the preserved swapping behavior of EGL. This lead to flicker because every second frame was swapping with an empty buffer and only the dirty areas were being painted leaving the rest empty. Reviewed-by: Lars Knoll Reviewed-by: Aleksandar Sasha Babic Task-number: QT-3198 Task-number: QT-3184 Task-number: QT-3201 --- src/openvg/qwindowsurface_vgegl.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index f46d6c2..46a905f 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -659,6 +659,7 @@ QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget) #endif windowSurface = context->createSurface(widget, &surfaceProps); isPaintingActive = false; + needToSwap = true; } #else if (context && size != newSize) { @@ -710,20 +711,21 @@ QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget) needToSwap = false; } #endif -#if !defined(QVG_NO_PRESERVED_SWAP) - // Try to force the surface back buffer to preserve its contents. - if (needToSwap) { - eglGetError(); // Clear error state first. - eglSurfaceAttrib(QEglContext::display(), surface, - EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); - if (eglGetError() != EGL_SUCCESS) { - qWarning("QVG: could not enable preserved swap"); - } - } -#endif windowSurface = surface; isPaintingActive = false; } + +#if !defined(QVG_NO_PRESERVED_SWAP) + // Try to force the surface back buffer to preserve its contents. + if (needToSwap) { + eglGetError(); // Clear error state first. + eglSurfaceAttrib(QEglContext::display(), windowSurface, + EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); + if (eglGetError() != EGL_SUCCESS) { + qWarning("QVG: could not enable preserved swap"); + } + } +#endif return context; } -- cgit v0.12 From 1ab962d75bd6754331536034022b882f0474196d Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 9 Apr 2010 17:01:32 +0200 Subject: Doc: we don't ship a qconfig executable in the Windows CE packages Task-number: QTBUG-9655 Reviewed-by: thartman --- doc/src/platforms/emb-features.qdoc | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/src/platforms/emb-features.qdoc b/doc/src/platforms/emb-features.qdoc index 1974a45..ab549d3 100644 --- a/doc/src/platforms/emb-features.qdoc +++ b/doc/src/platforms/emb-features.qdoc @@ -105,9 +105,6 @@ \note The \c qconfig tool is intended to be built against Qt on desktop platforms. - \bold{Windows CE:} The Qt for Windows CE package contains a \c qconfig - executable that you can run on a Windows desktop to configure the build. - \image qt-embedded-qconfigtool.png The \c qconfig tool's interface displays all of Qt's -- cgit v0.12 From 9fd909e427b6d7c6a7d20b5cd28c9d860c52b73a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 9 Apr 2010 17:25:03 +0200 Subject: Autotest: fix network test failure --- tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp index ca12f2a..3a3ea79 100644 --- a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp +++ b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp @@ -506,7 +506,8 @@ void tst_QHttpSocketEngine::tcpSocketNonBlockingTest() // Connect socket.connectToHost(QtNetworkSettings::serverName(), 143); - QCOMPARE(socket.state(), QTcpSocket::HostLookupState); + QVERIFY(socket.state() == QTcpSocket::HostLookupState || + socket.state() == QTcpSocket::ConnectingState); QTestEventLoop::instance().enterLoop(30); if (QTestEventLoop::instance().timeout()) { -- cgit v0.12 From cd5bfb680ce61d4cbe6081664494ee1046fce69a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 9 Apr 2010 17:29:42 +0200 Subject: Autotest: same as previous commit --- tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp index 0240a0e..a679765 100644 --- a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -647,7 +647,8 @@ void tst_QSocks5SocketEngine::tcpSocketNonBlockingTest() // Connect socket.connectToHost(QtNetworkSettings::serverName(), 143); - QCOMPARE(socket.state(), QTcpSocket::HostLookupState); + QVERIFY(socket.state() == QTcpSocket::HostLookupState || + socket.state() == QTcpSocket::ConnectingState); QTestEventLoop::instance().enterLoop(30); if (QTestEventLoop::instance().timeout()) { -- cgit v0.12 From d5d013b46ef2ea51172d364e8b32a82cb216056a Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sun, 11 Apr 2010 00:59:07 +0200 Subject: Fix a crash with global static objects When global static objects use text codecs in their constructor or destructor we would crash on symbian, as the symbian codec was trying to use a non existing cleanup stack. Task-number: QT-3255 Reviewed-by: Espen Riskedal --- src/corelib/codecs/qtextcodec.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index c0aa342..1a08cca 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -671,6 +671,11 @@ static void setup() if (all) return; +#ifdef Q_OS_SYMBIAN + if (User::TrapHandler() == NULL) + return; +#endif + #ifdef Q_DEBUG_TEXTCODEC if (destroying_is_ok) qWarning("QTextCodec: Creating new codec during codec cleanup"); -- cgit v0.12 From a2c609d977e0e6d6bcf9806a115f6c9119bf24f8 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Sun, 11 Apr 2010 18:50:56 +0200 Subject: Fix problem with accessibility clients not getting info from QFileDialog This fixes a problem with accessibility and QFileDialog, in addition the fix to complexwidgets.cpp will also fix any itemview that uses a root index. Reviewed-by: Jan-Arve --- src/gui/dialogs/qfiledialog.ui | 36 +++++++++++++++++++++++ src/plugins/accessible/widgets/complexwidgets.cpp | 3 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/gui/dialogs/qfiledialog.ui b/src/gui/dialogs/qfiledialog.ui index b52bd8a..1f35abb 100644 --- a/src/gui/dialogs/qfiledialog.ui +++ b/src/gui/dialogs/qfiledialog.ui @@ -83,6 +83,12 @@ Back + + Back + + + Go back + @@ -90,6 +96,12 @@ Forward + + Forward + + + Go forward + @@ -97,6 +109,12 @@ Parent Directory + + Parent Directory + + + Go to the parent directory + @@ -104,6 +122,12 @@ Create New Folder + + Create New Folder + + + Create a New Folder + @@ -111,6 +135,12 @@ List View + + List View + + + Change to list view mode + @@ -118,6 +148,12 @@ Detail View + + Detail View + + + Change to detail view mode + diff --git a/src/plugins/accessible/widgets/complexwidgets.cpp b/src/plugins/accessible/widgets/complexwidgets.cpp index b4ca8f2..8be1560 100644 --- a/src/plugins/accessible/widgets/complexwidgets.cpp +++ b/src/plugins/accessible/widgets/complexwidgets.cpp @@ -724,7 +724,8 @@ public: if (start.isValid()) { m_current = start; } else if (m_view && m_view->model()) { - m_current = view->model()->index(0, 0); + m_current = view->rootIndex().isValid() ? + view->rootIndex().child(0,0) : view->model()->index(0, 0); } } -- cgit v0.12 From a93532eb81a257bf04c3a9c55389bc25df14ea67 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 9 Apr 2010 15:23:44 +0200 Subject: Autotest: moved these to the qtest/ dir --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 2 +- tests/auto/qsslsocket/tst_qsslsocket.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 8813a80..890983e 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -3278,7 +3278,7 @@ void tst_QNetworkReply::lastModifiedHeaderForFile() void tst_QNetworkReply::lastModifiedHeaderForHttp() { // Tue, 22 May 2007 12:04:57 GMT according to webserver - QUrl url = "http://" + QtNetworkSettings::serverName() + "/gif/fluke.gif"; + QUrl url = "http://" + QtNetworkSettings::serverName() + "/qtest/fluke.gif"; QNetworkRequest request(url); QNetworkReplyPtr reply = manager.head(request); diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index c141caf..5dd7c19 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -1271,7 +1271,7 @@ void tst_QSslSocket::setReadBufferSize_task_250027() connect(socket, SIGNAL(readyRead()), &setReadBufferSize_task_250027_handler, SLOT(readyReadSlot())); // provoke a response by sending a request - socket->write("GET /gif/fluke.gif HTTP/1.0\n"); // this file is 27 KB + socket->write("GET /qtest/fluke.gif HTTP/1.0\n"); // this file is 27 KB socket->write("Host: "); socket->write(QtNetworkSettings::serverName().toLocal8Bit().constData()); socket->write("\n"); @@ -1520,7 +1520,6 @@ void tst_QSslSocket::verifyMode() loop.exec(); QVERIFY(clientSocket.isEncrypted()); - qDebug() << server.socket->sslErrors(); QVERIFY(server.socket->sslErrors().isEmpty()); } @@ -1736,7 +1735,7 @@ void tst_QSslSocket::readFromClosedSocket() socket->waitForConnected(); socket->waitForEncrypted(); // provoke a response by sending a request - socket->write("GET /gif/fluke.gif HTTP/1.1\n"); + socket->write("GET /qtest/fluke.gif HTTP/1.1\n"); socket->write("Host: "); socket->write(QtNetworkSettings::serverName().toLocal8Bit().constData()); socket->write("\n"); -- cgit v0.12 From 2f1e7ef93b7faaedf55fddbad280e4aada9bfb9d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 9 Apr 2010 17:13:01 +0200 Subject: Autotest: Use the file in the non-writeable area --- tests/auto/qfile/tst_qfile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp index f407b12..10c10eb 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/qfile/tst_qfile.cpp @@ -480,7 +480,7 @@ void tst_QFile::open_data() #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) QTest::newRow("//./PhysicalDrive0") << QString("//./PhysicalDrive0") << int(QIODevice::ReadOnly) << (bool)TRUE << QFile::NoError; - QTest::newRow("uncFile") << "//" + QtNetworkSettings::winServerName() + "/testsharewritable/test.pri" << int(QIODevice::ReadOnly) + QTest::newRow("uncFile") << "//" + QtNetworkSettings::winServerName() + "/testshare/test.pri" << int(QIODevice::ReadOnly) << true << QFile::NoError; #endif } @@ -552,7 +552,7 @@ void tst_QFile::size_data() QTest::newRow( "exist01" ) << QString(SRCDIR "testfile.txt") << (qint64)245; #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) // Only test UNC on Windows./ - QTest::newRow("unc") << "//" + QString(QtNetworkSettings::winServerName() + "/testsharewritable/test.pri") << (qint64)34; + QTest::newRow("unc") << "//" + QString(QtNetworkSettings::winServerName() + "/testshare/test.pri") << (qint64)34; #endif } @@ -2473,7 +2473,7 @@ void tst_QFile::miscWithUncPathAsCurrentDir() { #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) QString current = QDir::currentPath(); - QVERIFY(QDir::setCurrent("//" + QtNetworkSettings::winServerName() + "/testsharewritable")); + QVERIFY(QDir::setCurrent("//" + QtNetworkSettings::winServerName() + "/testshare")); QFile file("test.pri"); QVERIFY(file.exists()); QCOMPARE(int(file.size()), 34); -- cgit v0.12 From a321fd32ae1008736246b90ff0b149af498970ac Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 12 Apr 2010 10:50:29 +0200 Subject: econd half of the crash fix for codecs on Symbian Ensure that we do not try to use any codecs if we don't have a cleanup stack available on Symbian. Task-number: QT-3255 Reviewed-by: Iain --- src/corelib/codecs/qtextcodec.cpp | 34 ++++++++++++++++++++++++++++++++++ src/corelib/codecs/qtextcodec.h | 5 +++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 1a08cca..18538e3 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -103,6 +103,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QTextCodecFactoryInterface_iid, QLatin1String("/codecs"))) #endif + static char qtolower(register char c) { if (c >= 'A' && c <= 'Z') return c + 0x20; return c; } static bool qisalnum(register char c) @@ -217,6 +218,19 @@ QTextCodecCleanup::~QTextCodecCleanup() Q_GLOBAL_STATIC(QTextCodecCleanup, createQTextCodecCleanup) +bool QTextCodec::validCodecs() +{ +#ifdef Q_OS_SYMBIAN + // If we don't have a trap handler, we're outside of the main() function, + // ie. in global constructors or destructors. Don't use codecs in this + // case as it would lead to crashes because we don't have a cleanup stack on Symbian + return (User::TrapHandler() != NULL); +#else + return true; +#endif +} + + #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) class QWindowsLocalCodec: public QTextCodec { @@ -672,6 +686,9 @@ static void setup() return; #ifdef Q_OS_SYMBIAN + // If we don't have a trap handler, we're outside of the main() function, + // ie. in global constructors or destructors. Don't create codecs in this + // case as it would lead to crashes because of a missing cleanup stack on Symbian if (User::TrapHandler() == NULL) return; #endif @@ -969,6 +986,9 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name) #endif setup(); + if (!validCodecs()) + return 0; + static QHash cache; if (clearCaches & 0x1) { cache.clear(); @@ -1010,6 +1030,9 @@ QTextCodec* QTextCodec::codecForMib(int mib) #endif setup(); + if (!validCodecs()) + return 0; + static QHash cache; if (clearCaches & 0x2) { cache.clear(); @@ -1057,6 +1080,10 @@ QList QTextCodec::availableCodecs() setup(); QList codecs; + + if (!validCodecs()) + return codecs; + for (int i = 0; i < all->size(); ++i) { codecs += all->at(i)->name(); codecs += all->at(i)->aliases(); @@ -1095,6 +1122,10 @@ QList QTextCodec::availableMibs() setup(); QList codecs; + + if (!validCodecs()) + return codecs; + for (int i = 0; i < all->size(); ++i) codecs += all->at(i)->mibEnum(); @@ -1145,6 +1176,9 @@ void QTextCodec::setCodecForLocale(QTextCodec *c) QTextCodec* QTextCodec::codecForLocale() { + if (!validCodecs()) + return 0; + if (localeMapper) return localeMapper; diff --git a/src/corelib/codecs/qtextcodec.h b/src/corelib/codecs/qtextcodec.h index 169fe82..e82f8a4 100644 --- a/src/corelib/codecs/qtextcodec.h +++ b/src/corelib/codecs/qtextcodec.h @@ -145,12 +145,13 @@ public: private: friend class QTextCodecCleanup; static QTextCodec *cftr; + static bool validCodecs(); }; Q_DECLARE_OPERATORS_FOR_FLAGS(QTextCodec::ConversionFlags) -inline QTextCodec* QTextCodec::codecForTr() { return cftr; } + inline QTextCodec* QTextCodec::codecForTr() { return validCodecs() ? cftr : 0; } inline void QTextCodec::setCodecForTr(QTextCodec *c) { cftr = c; } -inline QTextCodec* QTextCodec::codecForCStrings() { return QString::codecForCStrings; } +inline QTextCodec* QTextCodec::codecForCStrings() { return validCodecs() ? QString::codecForCStrings : 0; } inline void QTextCodec::setCodecForCStrings(QTextCodec *c) { QString::codecForCStrings = c; } class Q_CORE_EXPORT QTextEncoder { -- cgit v0.12 From d32a818ecb2e707e548f2ad7a5222062db7edf32 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 12 Apr 2010 10:06:38 +0200 Subject: Fix crash with QTextEdit::textChanged() when deleting a character QTextEdit::textChanged() will be emitted from a function called from within QTextCursorPrivate. If the code connected to textChanged() makes a local copy of the current text cursor and then causes it to detach, we will crash when returning to QTextCursorPrivate and trying to access the now-deleted data. To avoid this, we make a local reference to the current text cursor that gives us a guarantee that it will be valid throughout the delete-call. Task-number: QTBUG-9599 Reviewed-by: Gunnar --- src/gui/text/qtextcontrol.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index aaaa3ca..2206e5e 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1199,7 +1199,8 @@ void QTextControlPrivate::keyPressEvent(QKeyEvent *e) blockFmt.setIndent(blockFmt.indent() - 1); cursor.setBlockFormat(blockFmt); } else { - cursor.deletePreviousChar(); + QTextCursor localCursor = cursor; + localCursor.deletePreviousChar(); } goto accept; } @@ -1232,7 +1233,8 @@ void QTextControlPrivate::keyPressEvent(QKeyEvent *e) } #endif else if (e == QKeySequence::Delete) { - cursor.deleteChar(); + QTextCursor localCursor = cursor; + localCursor.deleteChar(); } else if (e == QKeySequence::DeleteEndOfWord) { if (!cursor.hasSelection()) -- cgit v0.12 From a46b1d4060fd392c10d6c55d51f536ba92d9f5c3 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 12 Apr 2010 13:59:34 +0300 Subject: Improved support for OPTION and LINKEROPTION statements in MMP files VERSION_FLAGS. can now be used for all compilers and not just armcc, and version flagging can now be used with QMAKE_LFLAGS as well as QMAKE_CXXFLAGS. Also, MMP_OPTION_KEYWORDS variable is used to define supported keywords for OPTION and LINKEROPTION statements, which are defined via QMAKE_CXXFLAGS. and QMAKE_LFLAGS. variables. This improves flexibility in the future if new keywords need to be supported. Task-number: QTBUG-8685 Reviewed-by: Janne Koskinen --- mkspecs/common/symbian/symbian.conf | 2 +- qmake/generators/symbian/symmake.cpp | 163 ++++++++++++----------------------- qmake/generators/symbian/symmake.h | 9 ++ 3 files changed, 63 insertions(+), 111 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index d66d227..ba31116 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -26,7 +26,7 @@ QMAKE_CFLAGS_RELEASE = QMAKE_CFLAGS_DEBUG = QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses - +MMP_OPTION_KEYWORDS = CW ARMCC GCCE VERSION_FLAGS.ARMCC = ARMCC_4_0 QMAKE_CXX = g++ QMAKE_CXXFLAGS = $$QMAKE_CFLAGS diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index e1256d8..40ef934 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -79,12 +79,8 @@ #define MMP_TARGET "TARGET" #define MMP_TARGETTYPE "TARGETTYPE" #define MMP_SECUREID "SECUREID" -#define MMP_OPTION_CW "OPTION CW" -#define MMP_OPTION_ARMCC "OPTION ARMCC" -#define MMP_OPTION_GCCE "OPTION GCCE" -#define MMP_LINKEROPTION_CW "LINKEROPTION CW" -#define MMP_LINKEROPTION_ARMCC "LINKEROPTION ARMCC" -#define MMP_LINKEROPTION_GCCE "LINKEROPTION GCCE" +#define MMP_OPTION "OPTION" +#define MMP_LINKEROPTION "LINKEROPTION" #define MMP_CAPABILITY "CAPABILITY" #define MMP_EPOCALLOWDLLDATA "EPOCALLOWDLLDATA" #define MMP_EPOCHEAPSIZE "EPOCHEAPSIZE" @@ -95,6 +91,10 @@ #define MMP_START_RESOURCE "START RESOURCE" #define MMP_END_RESOURCE "END" +#define VAR_CXXFLAGS "QMAKE_CXXFLAGS" +#define VAR_CFLAGS "QMAKE_CFLAGS" +#define VAR_LFLAGS "QMAKE_LFLAGS" + #define SIS_TARGET "sis" #define INSTALLER_SIS_TARGET "installer_sis" #define ROM_STUB_SIS_TARGET "stub_sis" @@ -800,9 +800,7 @@ void SymbianMakefileGenerator::initMmpVariables() overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE) << QLatin1String(MMP_EPOCHEAPSIZE); restrictableMmpKeywords << QLatin1String(MMP_TARGET) << QLatin1String(MMP_SECUREID) - << QLatin1String(MMP_OPTION_CW) << QLatin1String(MMP_OPTION_ARMCC) - << QLatin1String(MMP_OPTION_GCCE) << QLatin1String(MMP_LINKEROPTION_CW) - << QLatin1String(MMP_LINKEROPTION_ARMCC) << QLatin1String(MMP_LINKEROPTION_GCCE) + << QLatin1String(MMP_OPTION) << QLatin1String(MMP_LINKEROPTION) << QLatin1String(MMP_CAPABILITY) << QLatin1String(MMP_EPOCALLOWDLLDATA) << QLatin1String(MMP_EPOCSTACKSIZE) << QLatin1String(MMP_UID) << QLatin1String(MMP_VENDORID) << QLatin1String(MMP_VERSION); @@ -1152,120 +1150,65 @@ void SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) t << endl << endl; } -void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileConditionalOptions(QTextStream& t, + const QString &optionType, + const QString &optionTag, + const QString &variableBase) { - QString cw, armcc, gcce; - QString cwlink, armlink, gccelink; - - if (0 != project->values("QMAKE_CXXFLAGS.CW").size()) { - cw.append(project->values("QMAKE_CXXFLAGS.CW").join(" ")); - cw.append(" "); - } - - if (0 != project->values("QMAKE_CXXFLAGS.ARMCC").size()) { - armcc.append(project->values("QMAKE_CXXFLAGS.ARMCC").join(" ")); - armcc.append(" "); - } - - if (0 != project->values("QMAKE_CXXFLAGS.GCCE").size()) { - gcce.append(project->values("QMAKE_CXXFLAGS.GCCE").join(" ")); - gcce.append(" "); - } - - if (0 != project->values("QMAKE_CFLAGS.CW").size()) { - cw.append(project->values("QMAKE_CFLAGS.CW").join(" ")); - cw.append(" "); - } - - if (0 != project->values("QMAKE_CFLAGS.ARMCC").size()) { - armcc.append(project->values("QMAKE_CFLAGS.ARMCC").join(" ")); - armcc.append(" "); - } - - if (0 != project->values("QMAKE_CFLAGS.GCCE").size()) { - gcce.append(project->values("QMAKE_CXXFLAGS.GCCE").join(" ")); - gcce.append(" "); - } - - if (0 != project->values("QMAKE_CXXFLAGS").size()) { - cw.append(project->values("QMAKE_CXXFLAGS").join(" ")); - cw.append(" "); - armcc.append(project->values("QMAKE_CXXFLAGS").join(" ")); - armcc.append(" "); - gcce.append(project->values("QMAKE_CXXFLAGS").join(" ")); - gcce.append(" "); + foreach(QString compilerVersion, project->values("VERSION_FLAGS." + optionTag)) { + QStringList currentValues = project->values(variableBase + "." + compilerVersion); + if (currentValues.size()) { + t << "#if defined(" << compilerVersion << ")" << endl; + t << optionType << " " << optionTag << " " << currentValues.join(" ") << endl; + t << "#endif" << endl; + } } +} - if (0 != project->values("QMAKE_CFLAGS").size()) { - cw.append(project->values("QMAKE_CFLAGS").join(" ")); - cw.append(" "); - armcc.append(project->values("QMAKE_CFLAGS").join(" ")); - armcc.append(" "); - gcce.append(project->values("QMAKE_CFLAGS").join(" ")); - gcce.append(" "); - } +void SymbianMakefileGenerator::writeMmpFileSimpleOption(QTextStream& t, + const QString &optionType, + const QString &optionTag, + const QString &options) +{ + QString trimmedOptions = options.trimmed(); + if (!trimmedOptions.isEmpty()) + t << optionType << " " << optionTag << " " << trimmedOptions << endl; +} - if (0 != project->values("QMAKE_LFLAGS.CW").size()) { - cwlink.append(project->values("QMAKE_LFLAGS.CW").join(" ")); - cwlink.append(" "); +void SymbianMakefileGenerator::appendMmpFileOptions(QString &options, const QStringList &list) +{ + if (list.size()) { + options.append(list.join(" ")); + options.append(" "); } +} - if (0 != project->values("QMAKE_LFLAGS.ARMCC").size()) { - armlink.append(project->values("QMAKE_LFLAGS.ARMCC").join(" ")); - armlink.append(" "); - } +void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) +{ + QStringList keywords = project->values("MMP_OPTION_KEYWORDS"); + QStringList commonCxxFlags = project->values(VAR_CXXFLAGS); + QStringList commonCFlags = project->values(VAR_CFLAGS); + QStringList commonLFlags = project->values(VAR_LFLAGS); - if (0 != project->values("QMAKE_LFLAGS.GCCE").size()) { - gccelink.append(project->values("QMAKE_LFLAGS.GCCE").join(" ")); - gccelink.append(" "); - } + foreach(QString item, keywords) { + QString compilerOption; + QString linkerOption; - if (0 != project->values("QMAKE_LFLAGS").size()) { - cwlink.append(project->values("QMAKE_LFLAGS").join(" ")); - cwlink.append(" "); - armlink.append(project->values("QMAKE_LFLAGS").join(" ")); - armlink.append(" "); - gccelink.append(project->values("QMAKE_LFLAGS").join(" ")); - gccelink.append(" "); - } + appendMmpFileOptions(compilerOption, project->values(VAR_CXXFLAGS "." + item)); + appendMmpFileOptions(compilerOption, project->values(VAR_CFLAGS "." + item)); + appendMmpFileOptions(compilerOption, commonCxxFlags); + appendMmpFileOptions(compilerOption, commonCFlags); - if (!cw.isEmpty() && cw[cw.size()-1] == ' ') - cw.chop(1); - if (!armcc.isEmpty() && armcc[armcc.size()-1] == ' ') - armcc.chop(1); - if (!gcce.isEmpty() && gcce[gcce.size()-1] == ' ') - gcce.chop(1); - if (!cwlink.isEmpty() && cwlink[cwlink.size()-1] == ' ') - cwlink.chop(1); - if (!armlink.isEmpty() && armlink[armlink.size()-1] == ' ') - armlink.chop(1); - if (!gccelink.isEmpty() && gccelink[gccelink.size()-1] == ' ') - gccelink.chop(1); + appendMmpFileOptions(linkerOption, project->values(VAR_LFLAGS "." + item)); + appendMmpFileOptions(linkerOption, commonLFlags); - if (!cw.isEmpty()) - t << MMP_OPTION_CW " " << cw << endl; - if (!armcc.isEmpty()) - t << MMP_OPTION_ARMCC " " << armcc << endl; + writeMmpFileSimpleOption(t, MMP_OPTION, item, compilerOption); + writeMmpFileSimpleOption(t, MMP_LINKEROPTION, item, linkerOption); - foreach(QString armccVersion, project->values("VERSION_FLAGS.ARMCC")) { - QStringList currentValues = project->values("QMAKE_CXXFLAGS." + armccVersion); - if (currentValues.size()) { - t << "#if defined(" << armccVersion << ")" << endl; - t << MMP_OPTION_ARMCC " " << currentValues.join(" ") << endl; - t << "#endif" << endl; - } + writeMmpFileConditionalOptions(t, MMP_OPTION, item, VAR_CXXFLAGS); + writeMmpFileConditionalOptions(t, MMP_LINKEROPTION, item, VAR_LFLAGS); } - if (!gcce.isEmpty()) - t << MMP_OPTION_GCCE " " << gcce << endl; - - if (!cwlink.isEmpty()) - t << MMP_LINKEROPTION_CW " " << cwlink << endl; - if (!armlink.isEmpty()) - t << MMP_LINKEROPTION_ARMCC " " << armlink << endl; - if (!gccelink.isEmpty()) - t << MMP_LINKEROPTION_GCCE " " << gccelink << endl; - t << endl; } diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index 9de852a..90c8549 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -124,6 +124,15 @@ protected: void writeMmpFileIncludePart(QTextStream& t); void writeMmpFileLibraryPart(QTextStream& t); void writeMmpFileCapabilityPart(QTextStream& t); + void writeMmpFileConditionalOptions(QTextStream& t, + const QString &optionType, + const QString &optionTag, + const QString &variableBase); + void writeMmpFileSimpleOption(QTextStream& t, + const QString &optionType, + const QString &optionTag, + const QString &options); + void appendMmpFileOptions(QString &options, const QStringList &list); void writeMmpFileCompilerOptionPart(QTextStream& t); void writeMmpFileBinaryVersionPart(QTextStream& t); void writeMmpFileRulesPart(QTextStream& t); -- cgit v0.12