summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-09 18:43:14 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-09 18:43:14 (GMT)
commit587f4325850615392e99881e060121bd5ea85360 (patch)
treec563522a355de79e857287a71a00115213262b81
parent690e54dda08496d80526ae64dcb1fb88f533542b (diff)
parent385f2c8a34a52443e78dfa272a1a483b9d6d29fc (diff)
downloadQt-587f4325850615392e99881e060121bd5ea85360.zip
Qt-587f4325850615392e99881e060121bd5ea85360.tar.gz
Qt-587f4325850615392e99881e060121bd5ea85360.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public: Enable preserved swap behavior when surface is created due to resize. Generate triggered signal even the action launches menu in Symbian. Symbian emulator: unload file server so apps can be recompiled. Clear QFontCache TLS content before nullifying TLS pointer. Fixed focus and window activation events on Symbian when opening menu. QTBUG-4887 and other exception safety fixes
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp22
-rw-r--r--src/gui/image/qimage.cpp6
-rw-r--r--src/gui/kernel/qapplication_s60.cpp12
-rw-r--r--src/gui/kernel/qsoftkeymanager_s60.cpp35
-rw-r--r--src/gui/kernel/qsoftkeymanager_s60_p.h1
-rw-r--r--src/gui/kernel/qt_s60_p.h1
-rw-r--r--src/gui/kernel/qwidget.cpp8
-rw-r--r--src/gui/text/qfont.cpp4
-rw-r--r--src/gui/widgets/qmenu.cpp14
-rw-r--r--src/openvg/qwindowsurface_vgegl.cpp24
-rw-r--r--tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp19
11 files changed, 111 insertions, 35 deletions
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 <exception>
# include <f32file.h>
+# include <e32ldr.h>
# 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();
}
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..61beb4f 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;
}
@@ -989,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);
@@ -1239,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..c0761f0 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<QWidget*>();
@@ -394,15 +407,15 @@ bool QSoftKeyManagerPrivateS60::handleCommand(int command)
action->setProperty("_q_action_widget", v);
}
qt_symbian_next_menu_from_action(actionContainer);
- QT_TRAP_THROWING(S60->menuBar()->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;
- }
+ QT_TRAP_THROWING(tryDisplayMenuBarL());
+ }
+
+ 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;
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();
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/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
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<QAction *, QWidget *>::iterator it = d->widgetItems.begin();
- for (; it != d->widgetItems.end(); ++it) {
- if (QWidget *widget = it.value()) {
- QWidgetAction *action = static_cast<QWidgetAction *>(it.key());
- action->releaseWidget(widget);
- *it = 0;
+ if (!d->widgetItems.isEmpty()) { // avoid detach on shared null hash
+ QHash<QAction *, QWidget *>::iterator it = d->widgetItems.begin();
+ for (; it != d->widgetItems.end(); ++it) {
+ if (QWidget *widget = it.value()) {
+ QWidgetAction *action = static_cast<QWidgetAction *>(it.key());
+ action->releaseWidget(widget);
+ *it = 0;
+ }
}
}
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;
}
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 <QtTest/QtTest>
#include <stddef.h>
+#include <exception>
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());