From 8502f76e820ab79181a1b8ac54c8431b298a2023 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Fri, 22 May 2009 10:53:31 +0200 Subject: Mark data as static, use fetch-and-store instead of test-and-set Mark the objectCount and mutex-pool as static as they won't ever be externed. Use fetch-and-store zero instead of test-and-set from current value to zero. --- src/corelib/kernel/qobject.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index cfd8493..1e9e284 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -92,8 +92,8 @@ static int *queuedConnectionTypes(const QList &typeNames) return types; } -QBasicAtomicPointer signalSlotMutexes = Q_BASIC_ATOMIC_INITIALIZER(0); -QBasicAtomicInt objectCount = Q_BASIC_ATOMIC_INITIALIZER(0); +static QBasicAtomicPointer signalSlotMutexes = Q_BASIC_ATOMIC_INITIALIZER(0); +static QBasicAtomicInt objectCount = Q_BASIC_ATOMIC_INITIALIZER(0); /** \internal * mutex to be locked when accessing the connectionlists or the senders list @@ -117,8 +117,7 @@ extern "C" Q_CORE_EXPORT void qt_addObject(QObject *) extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *) { if(!objectCount.deref()) { - QMutexPool *old = signalSlotMutexes; - signalSlotMutexes.testAndSetAcquire(old, 0); + QMutexPool *old = signalSlotMutexes.fetchAndStoreAcquire(0); delete old; } } -- cgit v0.12 From 31fcf8e77f8ef8020edfbfd224cf6e68cb0450bf Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Fri, 22 May 2009 11:01:39 +0200 Subject: Update the QMutexPool API to be more like QMutex If we ever decide to make this class public, the interfaces should be similar. --- src/corelib/thread/qmutexpool.cpp | 14 +++++++------- src/corelib/thread/qmutexpool_p.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/corelib/thread/qmutexpool.cpp b/src/corelib/thread/qmutexpool.cpp index 96a9940..77a3cca 100644 --- a/src/corelib/thread/qmutexpool.cpp +++ b/src/corelib/thread/qmutexpool.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE // qt_global_mutexpool is here for backwards compatability only, // use QMutexpool::instance() in new clode. Q_CORE_EXPORT QMutexPool *qt_global_mutexpool = 0; -Q_GLOBAL_STATIC_WITH_ARGS(QMutexPool, globalMutexPool, (true)) +Q_GLOBAL_STATIC_WITH_ARGS(QMutexPool, globalMutexPool, (QMutex::Recursive)) /*! \class QMutexPool @@ -88,15 +88,15 @@ Q_GLOBAL_STATIC_WITH_ARGS(QMutexPool, globalMutexPool, (true)) */ /*! - Constructs a QMutexPool, reserving space for \a size QMutexes. If - \a recursive is true, all QMutexes in the pool will be recursive - mutexes; otherwise they will all be non-recursive (the default). + Constructs a QMutexPool, reserving space for \a size QMutexes. All + mutexes in the pool are created with \a recursionMode. By default, + all mutexes are non-recursive. The QMutexes are created when needed, and deleted when the QMutexPool is destructed. */ -QMutexPool::QMutexPool(bool recursive, int size) - : mutexes(size), count(size), recurs(recursive) +QMutexPool::QMutexPool(QMutex::RecursionMode recursionMode, int size) + : mutexes(size), count(size), recursionMode(recursionMode) { for (int index = 0; index < count; ++index) { mutexes[index] = 0; @@ -134,7 +134,7 @@ QMutex *QMutexPool::get(const void *address) if (!mutexes[index]) { // mutex not created, create one - QMutex *newMutex = new QMutex(recurs ? QMutex::Recursive : QMutex::NonRecursive); + QMutex *newMutex = new QMutex(recursionMode); if (!mutexes[index].testAndSetOrdered(0, newMutex)) delete newMutex; } diff --git a/src/corelib/thread/qmutexpool_p.h b/src/corelib/thread/qmutexpool_p.h index 1009ebb..4c1e32c 100644 --- a/src/corelib/thread/qmutexpool_p.h +++ b/src/corelib/thread/qmutexpool_p.h @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE class Q_CORE_EXPORT QMutexPool { public: - explicit QMutexPool(bool recursive = false, int size = 128); + explicit QMutexPool(QMutex::RecursionMode recursionMode = QMutex::NonRecursive, int size = 128); ~QMutexPool(); QMutex *get(const void *address); @@ -74,7 +74,7 @@ public: private: QVarLengthArray, 128> mutexes; int count; - bool recurs; + QMutex::RecursionMode recursionMode; }; extern Q_CORE_EXPORT QMutexPool *qt_global_mutexpool; -- cgit v0.12 From 6b7736e5cc352f1326989eee8dd9ef87f2b9a486 Mon Sep 17 00:00:00 2001 From: Kavindra Devi Palaraja Date: Fri, 22 May 2009 11:06:28 +0200 Subject: Doc - removing the constraint on font size. Reviewed-By: David Boddie --- tools/qdoc3/test/classic.css | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css index 8e9eb78..e700e0a 100644 --- a/tools/qdoc3/test/classic.css +++ b/tools/qdoc3/test/classic.css @@ -1,9 +1,6 @@ BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { font-family: Arial, Geneva, Helvetica, sans-serif; } -BODY,TD { - font-size: 90%; -} H1 { text-align: center; font-size: 160%; -- cgit v0.12 From 87911c6c97b11bd7d10a38698460174b6cadfbe8 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 20 May 2009 09:50:47 +0200 Subject: Fix a leak because of an old legacy of QPixmapCache string API We have to replace the pixmap in the cache if it was previously there, we don't need to insert a new pixmap if a full update has been triggered. Reviewed-by:mbm --- src/gui/graphicsview/qgraphicsscene.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 1fbda85..126ea5b 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4759,10 +4759,7 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte } // Find pixmap in cache. - if (!itemCache->allExposed) - pixmapFound = QPixmapCache::find(pixmapKey, &pix); - else - pixmapFound = false; + pixmapFound = QPixmapCache::find(pixmapKey, &pix); // Render using item coordinate cache mode. if (cacheMode == QGraphicsItem::ItemCoordinateCache) { -- cgit v0.12