summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Read <ext-murray.2.read@nokia.com>2012-02-06 15:33:30 +0000
committerPasi Pentikäinen <ext-pasi.a.pentikainen@nokia.com>2012-02-08 17:47:02 +0100
commit543b7379316d99035d0bcb32a9341ac572996842 (patch)
tree24c1353ecb853775887a198e597bb7885433ae06
parent3c65a2e0af387c455fcc3a20323af7fc254fd4c2 (diff)
downloadqt4-tools-543b7379316d99035d0bcb32a9341ac572996842.tar.gz
Changes in Symbian CleanupStack use to allow dodgy app start
Some important apps were found to invoke Qt code using the Symbian CleanupStack during static data initialization. This is not legal Qt code, but due to the importance of maintaining compatability with these apps, Qt has been modified to avoid the problem. In one case by removing unnessary use of CleanupStack. In the other by creating a temporary CleanupStack. Task-number: ou1cimx1#960665 Change-Id: Iff631a638dceec10aa38add88ba93a63a831a574 Reviewed-by: Shane Kearns <ext-shane.2.kearns@nokia.com> (cherry picked from commit f343fc7c0844fc33886f3e25d49e043062c06e7a) Reviewed-by: Pasi Pentikäinen <ext-pasi.a.pentikainen@nokia.com>
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp21
-rw-r--r--src/corelib/tools/qdatetime.cpp2
2 files changed, 11 insertions, 12 deletions
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 781a5f0130..50c0d6c1d9 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -191,18 +191,15 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode)
if(openMode & QIODevice::Text)
symbianMode |= EFileStreamText;
- // pre Symbian 9.4, file I/O is always unbuffered, and the enum values don't exist
- if(QSysInfo::symbianVersion() >= QSysInfo::SV_9_4) {
- if (openMode & QFile::Unbuffered) {
- if (openMode & QIODevice::WriteOnly)
- symbianMode |= 0x00001000; //EFileWriteDirectIO;
- // ### Unbuffered read is not used, because it prevents file open in /resource
- // ### and has no obvious benefits
- } else {
- if (openMode & QIODevice::WriteOnly)
- symbianMode |= 0x00000800; //EFileWriteBuffered;
- // use implementation defaults for read buffering
- }
+ if (openMode & QFile::Unbuffered) {
+ if (openMode & QIODevice::WriteOnly)
+ symbianMode |= 0x00001000; //EFileWriteDirectIO;
+ // ### Unbuffered read is not used, because it prevents file open in /resource
+ // ### and has no obvious benefits
+ } else {
+ if (openMode & QIODevice::WriteOnly)
+ symbianMode |= 0x00000800; //EFileWriteBuffered;
+ // use implementation defaults for read buffering
}
// Until Qt supports file sharing, we can't support EFileShareReadersOrWriters safely,
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index e1b42324dc..ab3e4d3538 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -4038,6 +4038,7 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time)
tm res;
if(err == KErrNone) {
TTime utcTTime = epochTTime + tTimeIntervalSecsSince1Jan1970UTC;
+ CTrapCleanup *cleanup = CTrapCleanup::New(); // needed to avoid crashes in apps that previously were able to use this function in static data initialization
TRAP(err,
RTz tz;
User::LeaveIfError(tz.Connect());
@@ -4048,6 +4049,7 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time)
User::LeaveIfError(tz.ConvertToLocalTime(utcTTime));
CleanupStack::PopAndDestroy(tzId);
CleanupStack::PopAndDestroy(&tz));
+ delete cleanup;
if (KErrNone == err) {
TDateTime localDateTime = utcTTime.DateTime();
res.tm_sec = localDateTime.Second();