From f74570b72bd71f3747521a5f561971165f3297e5 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 9 Oct 2009 13:58:08 +0300 Subject: 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 --- src/corelib/io/qfsfileengine_unix.cpp | 15 +++++++++++++-- 1 file 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(mapAddress); maps[address] = QPair(extra, size); -- cgit v0.12