summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-12 17:09:04 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-12 17:09:04 (GMT)
commite9a0067ef4b272f1893522959dc15561970590ea (patch)
tree234241d0d6dbbf29857c4e66d2723f77239f31ee /src/corelib
parent6f736694461edc25b6e757f40ab9cad6a9207ad4 (diff)
parentb3fd9918d2c2d46780d3f924888a67d33f246233 (diff)
downloadQt-e9a0067ef4b272f1893522959dc15561970590ea.zip
Qt-e9a0067ef4b272f1893522959dc15561970590ea.tar.gz
Qt-e9a0067ef4b272f1893522959dc15561970590ea.tar.bz2
Merge branch 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration into 4.7-integration
* 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration: (54 commits) Improved support for OPTION and LINKEROPTION statements in MMP files Fix crash with QTextEdit::textChanged() when deleting a character econd half of the crash fix for codecs on Symbian Autotest: Use the file in the non-writeable area Autotest: moved these to the qtest/ dir Fix problem with accessibility clients not getting info from QFileDialog Fix a crash with global static objects Autotest: same as previous commit Autotest: fix network test failure Doc: we don't ship a qconfig executable in the Windows CE packages Enable preserved swap behavior when surface is created due to resize. Fixed possible data corruption in the triangulating stroker. 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. Fixed caching of QPainter patterns in the GL 2 engine. Fixes CursorChange and TooltipChange events delivery for QGraphicsWidget QTableView: fix spans corruption when removing spans. Fixes painting artifacts when scaling a QGraphicsProxyWidget. ...
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/codecs/qtextcodec.cpp39
-rw-r--r--src/corelib/codecs/qtextcodec.h5
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp22
3 files changed, 64 insertions, 2 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 72b0128..59a601e 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -110,6 +110,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)
@@ -224,6 +225,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
{
@@ -710,6 +724,14 @@ static void setup()
if (all)
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
+
#ifdef Q_DEBUG_TEXTCODEC
if (destroying_is_ok)
qWarning("QTextCodec: Creating new codec during codec cleanup");
@@ -1012,6 +1034,9 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
#endif
setup();
+ if (!validCodecs())
+ return 0;
+
static QHash <QByteArray, QTextCodec *> cache;
if (clearCaches & 0x1) {
cache.clear();
@@ -1053,6 +1078,9 @@ QTextCodec* QTextCodec::codecForMib(int mib)
#endif
setup();
+ if (!validCodecs())
+ return 0;
+
static QHash <int, QTextCodec *> cache;
if (clearCaches & 0x2) {
cache.clear();
@@ -1100,6 +1128,10 @@ QList<QByteArray> QTextCodec::availableCodecs()
setup();
QList<QByteArray> codecs;
+
+ if (!validCodecs())
+ return codecs;
+
for (int i = 0; i < all->size(); ++i) {
codecs += all->at(i)->name();
codecs += all->at(i)->aliases();
@@ -1138,6 +1170,10 @@ QList<int> QTextCodec::availableMibs()
setup();
QList<int> codecs;
+
+ if (!validCodecs())
+ return codecs;
+
for (int i = 0; i < all->size(); ++i)
codecs += all->at(i)->mibEnum();
@@ -1191,6 +1227,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 e37527d..4ba8b85 100644
--- a/src/corelib/codecs/qtextcodec.h
+++ b/src/corelib/codecs/qtextcodec.h
@@ -148,12 +148,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 {
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 8fc3fb8..1a1f978 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();
}