diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-01-21 16:59:19 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-01-21 16:59:19 (GMT) |
commit | 383a7129a1dffc54d8ebbc2c6497792b72fea6f1 (patch) | |
tree | 7751e691ef56433bdda9af46832bcc0939f87c30 | |
parent | d9e7e75666ace6ffc57fbfc090cbcf8a749afc2d (diff) | |
parent | 586bbfdd296a55edb42c14bacd7901d7c074fd9a (diff) | |
download | Qt-383a7129a1dffc54d8ebbc2c6497792b72fea6f1.zip Qt-383a7129a1dffc54d8ebbc2c6497792b72fea6f1.tar.gz Qt-383a7129a1dffc54d8ebbc2c6497792b72fea6f1.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public:
make the test a bit stricter
ignore the warning from auto-detach in destructor
get rid of extra calls to handle()
simplify QSharedMemory::detach()
avoid extra calculations
fix error reporting on detach()
fix error reporting
Make QMAKE_EXTENSION_SHLIB and friends work in all Symbian mkspecs.
-rw-r--r-- | mkspecs/common/symbian/symbian-makefile.conf | 3 | ||||
-rw-r--r-- | mkspecs/common/symbian/symbian.conf | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qsharedmemory.cpp | 6 | ||||
-rw-r--r-- | src/corelib/kernel/qsharedmemory_unix.cpp | 14 | ||||
-rw-r--r-- | src/corelib/kernel/qsharedmemory_win.cpp | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qsystemsemaphore_symbian.cpp | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qsystemsemaphore_win.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp | 5 |
8 files changed, 18 insertions, 23 deletions
diff --git a/mkspecs/common/symbian/symbian-makefile.conf b/mkspecs/common/symbian/symbian-makefile.conf index 364e91b..0360615 100644 --- a/mkspecs/common/symbian/symbian-makefile.conf +++ b/mkspecs/common/symbian/symbian-makefile.conf @@ -22,11 +22,8 @@ QMAKE_ELF2E32_FLAGS = --dlldata \ include(../../common/unix.conf) QMAKE_PREFIX_SHLIB = -QMAKE_EXTENSION_SHLIB = dll CONFIG *= no_plugin_name_prefix -QMAKE_EXTENSION_PLUGIN = dll QMAKE_PREFIX_STATICLIB = -QMAKE_EXTENSION_STATICLIB = lib QMAKE_SYMBIAN_SHLIB = 1 is_using_gnupoc { diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index ab94cfb..5619d4f 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -13,6 +13,9 @@ QMAKE_COMPILER_DEFINES += SYMBIAN QMAKE_EXT_OBJ = .o QMAKE_EXT_RES = _res.o +QMAKE_EXTENSION_SHLIB = dll +QMAKE_EXTENSION_PLUGIN = dll +QMAKE_EXTENSION_STATICLIB = lib QMAKE_LEX = flex QMAKE_LEXFLAGS = diff --git a/src/corelib/kernel/qsharedmemory.cpp b/src/corelib/kernel/qsharedmemory.cpp index 2fd6c50..85b37d0 100644 --- a/src/corelib/kernel/qsharedmemory.cpp +++ b/src/corelib/kernel/qsharedmemory.cpp @@ -399,11 +399,7 @@ bool QSharedMemory::detach() return false; #endif - if (d->detach()) { - d->size = 0; - return true; - } - return false; + return d->detach(); } /*! diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp index bea5b63..ddb0e34 100644 --- a/src/corelib/kernel/qsharedmemory_unix.cpp +++ b/src/corelib/kernel/qsharedmemory_unix.cpp @@ -199,7 +199,7 @@ bool QSharedMemoryPrivate::create(int size) } // create - if (-1 == shmget(handle(), size, 0666 | IPC_CREAT | IPC_EXCL)) { + if (-1 == shmget(unix_key, size, 0666 | IPC_CREAT | IPC_EXCL)) { QString function = QLatin1String("QSharedMemory::create"); switch (errno) { case EINVAL: @@ -220,10 +220,7 @@ bool QSharedMemoryPrivate::create(int size) bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode mode) { // grab the shared memory segment id - if (!handle()) - return false; - - int id = shmget(handle(), 0, (mode == QSharedMemory::ReadOnly ? 0444 : 0660)); + int id = shmget(unix_key, 0, (mode == QSharedMemory::ReadOnly ? 0444 : 0660)); if (-1 == id) { setErrorString(QLatin1String("QSharedMemory::attach (shmget)")); return false; @@ -265,12 +262,11 @@ bool QSharedMemoryPrivate::detach() return false; } memory = 0; + size = 0; // Get the number of current attachments - if (!handle()) - return false; - int id = shmget(handle(), 0, 0444); - unix_key = 0; + int id = shmget(unix_key, 0, 0444); + cleanHandle(); struct shmid_ds shmid_ds; if (0 != shmctl(id, IPC_STAT, &shmid_ds)) { diff --git a/src/corelib/kernel/qsharedmemory_win.cpp b/src/corelib/kernel/qsharedmemory_win.cpp index 85600a2..ac9c86a 100644 --- a/src/corelib/kernel/qsharedmemory_win.cpp +++ b/src/corelib/kernel/qsharedmemory_win.cpp @@ -124,8 +124,8 @@ bool QSharedMemoryPrivate::cleanHandle() { if (hand != 0 && !CloseHandle(hand)) { hand = 0; - return false; setErrorString(QLatin1String("QSharedMemory::cleanHandle")); + return false; } hand = 0; return true; @@ -186,6 +186,7 @@ bool QSharedMemoryPrivate::detach() return false; } memory = 0; + size = 0; // close handle return cleanHandle(); diff --git a/src/corelib/kernel/qsystemsemaphore_symbian.cpp b/src/corelib/kernel/qsystemsemaphore_symbian.cpp index 07cfffc..0d257b8 100644 --- a/src/corelib/kernel/qsystemsemaphore_symbian.cpp +++ b/src/corelib/kernel/qsystemsemaphore_symbian.cpp @@ -73,6 +73,7 @@ void QSystemSemaphorePrivate::setErrorString(const QString &function, int err) case KErrInUse: errorString = QCoreApplication::tr("%1: out of resources", "QSystemSemaphore").arg(function); error = QSystemSemaphore::OutOfResources; + break; case KErrPermissionDenied: errorString = QCoreApplication::tr("%1: permission denied", "QSystemSemaphore").arg(function); error = QSystemSemaphore::PermissionDenied; @@ -97,8 +98,7 @@ int QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode) if (key.isEmpty()) return 0; - QString safeName = makeKeyFileName(); - TPtrC name(qt_QString2TPtrC(safeName)); + TPtrC name(qt_QString2TPtrC(fileName)); int err = KErrAlreadyExists; int tryCount = 10; // Sort out race conditions by retrying several times until existing handle is acquired. diff --git a/src/corelib/kernel/qsystemsemaphore_win.cpp b/src/corelib/kernel/qsystemsemaphore_win.cpp index 7f002f8..fad50f2 100644 --- a/src/corelib/kernel/qsystemsemaphore_win.cpp +++ b/src/corelib/kernel/qsystemsemaphore_win.cpp @@ -86,8 +86,7 @@ HANDLE QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode) // Create it if it doesn't already exists. if (semaphore == 0) { - QString safeName = makeKeyFileName(); - semaphore = CreateSemaphore(0, initialValue, MAXLONG, (wchar_t*)safeName.utf16()); + semaphore = CreateSemaphore(0, initialValue, MAXLONG, (wchar_t*)fileName.utf16()); if (semaphore == NULL) setErrorString(QLatin1String("QSystemSemaphore::handle")); } diff --git a/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp index 50205bc..f11519b 100644 --- a/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp +++ b/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp @@ -332,6 +332,8 @@ void tst_QSharedMemory::attach() QVERIFY(sm.detach()); // Make sure detach doesn't screw up something and we can't re-attach. QVERIFY(sm.attach()); + QVERIFY(sm.data() != 0); + QVERIFY(sm.size() != 0); QVERIFY(sm.detach()); QCOMPARE(sm.size(), 0); QVERIFY(sm.data() == 0); @@ -358,7 +360,8 @@ void tst_QSharedMemory::lock() QVERIFY(shm.lock()); QTest::ignoreMessage(QtWarningMsg, "QSharedMemory::lock: already locked"); QVERIFY(shm.lock()); - // don't lock forever + // we didn't unlock(), so ignore the warning from auto-detach in destructor + QTest::ignoreMessage(QtWarningMsg, "QSharedMemory::lock: already locked"); } /*! |