OSDN Git Service

do not use QMutexPool in QPropertyAnimation and QVariantAnimation
authorIvailo Monev <xakepa10@gmail.com>
Mon, 9 Nov 2020 00:17:43 +0000 (02:17 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Mon, 9 Nov 2020 00:17:43 +0000 (02:17 +0200)
upstream commit:
https://github.com/qt/qtbase/commit/1e6514a714c1f55b9cb57d2b8b65bc2305c2e2c6

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/animation/qpropertyanimation.cpp
src/gui/animation/qvariantanimation.cpp

index c47b968..7d03f4d 100644 (file)
 #include "qpropertyanimation.h"
 #include "qanimationgroup.h"
 #include "qpropertyanimation_p.h"
-
-#include "qmutexpool_p.h"
+#include "qmutex.h"
 
 #ifndef QT_NO_ANIMATION
 
 QT_BEGIN_NAMESPACE
 
+Q_GLOBAL_STATIC(QMutex, qPropertyAnimationMutex)
+
 void QPropertyAnimationPrivate::updateMetaProperty()
 {
     if (!target || propertyName.isEmpty()) {
@@ -253,7 +254,7 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State newState,
 
     QPropertyAnimation *animToStop = 0;
     {
-        QMutexLocker locker(QMutexPool::globalInstanceGet(&staticMetaObject));
+        QMutexLocker locker(qPropertyAnimationMutex());
         typedef QPair<QObject *, QByteArray> QPropertyAnimationPair;
         typedef QHash<QPropertyAnimationPair, QPropertyAnimation*> QPropertyAnimationHash;
         static QPropertyAnimationHash hash;
index 9e717cb..0fcd50c 100644 (file)
@@ -37,7 +37,6 @@
 #include <QtCore/qrect.h>
 #include <QtCore/qline.h>
 #include <QtCore/qmutex.h>
-#include "qmutexpool_p.h"
 
 #ifndef QT_NO_ANIMATION
 
@@ -147,6 +146,8 @@ QT_BEGIN_NAMESPACE
     \sa currentValue
 */
 
+Q_GLOBAL_STATIC(QMutex, qVariantAnimationMutex)
+
 static bool animationValueLessThan(const QVariantAnimation::KeyValue &p1, const QVariantAnimation::KeyValue &p2)
 {
     return p1.first < p2.first;
@@ -424,7 +425,7 @@ void QVariantAnimation::registerInterpolator(QVariantAnimation::Interpolator fun
     // in such an order that we get here with interpolators == NULL,
     // to continue causes the app to crash on exit with a SEGV
     if (interpolators) {
-        QMutexLocker locker(QMutexPool::globalInstanceGet(interpolators));
+        QMutexLocker locker(qVariantAnimationMutex());
         if (interpolationType >= interpolators->count())
             interpolators->resize(interpolationType + 1);
         interpolators->replace(interpolationType, func);
@@ -434,7 +435,7 @@ void QVariantAnimation::registerInterpolator(QVariantAnimation::Interpolator fun
 QVariantAnimation::Interpolator QVariantAnimationPrivate::getInterpolator(int interpolationType)
 {
     QInterpolatorVector *interpolators = registeredInterpolators();
-    QMutexLocker locker(QMutexPool::globalInstanceGet(interpolators));
+    QMutexLocker locker(qVariantAnimationMutex());
     if (interpolationType < interpolators->count()) {
         QVariantAnimation::Interpolator ret = interpolators->at(interpolationType);
         if (ret) return ret;