diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-10-09 10:58:08 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-10-09 10:59:14 (GMT) |
commit | f74570b72bd71f3747521a5f561971165f3297e5 (patch) | |
tree | a2875377264cdb24d19b9ab3a38f5a6ebd69f089 /src | |
parent | 803bebe62face37310fd8d8b97ca7faa1d4284a8 (diff) | |
download | Qt-f74570b72bd71f3747521a5f561971165f3297e5.zip Qt-f74570b72bd71f3747521a5f561971165f3297e5.tar.gz Qt-f74570b72bd71f3747521a5f561971165f3297e5.tar.bz2 |
Fix for tst_qfile::map auto test in Symbian OS 3.1.
The map test case panic with E32User-Cbase 66 in N95 without this fix.
This happens sisnce Open C bug where mmap may leave and trap handler is
not inside OpenC. The workaround is to install the necessary TRAP
handler in Qt, before calling mmap.
AutoTests: tst_qfile::map passes
Reviewed-by: Janne Koskinen
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qfsfileengine_unix.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 114da3b..b0cddaa 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1255,8 +1255,19 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla int realOffset = offset / pagesSize; int extra = offset % pagesSize; - void *mapAddress = mmap((void*)0, (size_t)size + extra, - access, MAP_SHARED, nativeHandle(), realOffset * pagesSize); +#ifdef Q_OS_SYMBIAN + void *mapAddress; + TRAPD(err, mapAddress = mmap((void*)0, (size_t)size + extra, + access, MAP_SHARED, nativeHandle(), realOffset * pagesSize)); + if (err != KErrNone) { + qWarning("OpenC bug: leave from mmap %d", err); + mapAddress = MAP_FAILED; + errno = EINVAL; + } +#else + void *mapAddress = mmap((void*)0, (size_t)size + extra, + access, MAP_SHARED, nativeHandle(), realOffset * pagesSize); +#endif if (MAP_FAILED != mapAddress) { uchar *address = extra + static_cast<uchar*>(mapAddress); maps[address] = QPair<int,int>(extra, size); |