OSDN Git Service

correct deref conditions in ExceptionHolder and QFontCache
authorIvailo Monev <xakepa10@gmail.com>
Sun, 22 Nov 2020 04:47:02 +0000 (04:47 +0000)
committerIvailo Monev <xakepa10@gmail.com>
Sun, 22 Nov 2020 04:47:02 +0000 (04:47 +0000)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/core/concurrent/qtconcurrentexception.cpp
src/gui/text/qfont.cpp

index 6f1ccd8..357f48e 100644 (file)
@@ -158,7 +158,7 @@ void ExceptionHolder::operator=(const ExceptionHolder &other)
     if (base == other.base)
         return;
 
-    if (base->refCount.deref() == false)
+    if (!base->refCount.deref())
         delete base;
 
     base = other.base;
@@ -167,7 +167,7 @@ void ExceptionHolder::operator=(const ExceptionHolder &other)
 
 ExceptionHolder::~ExceptionHolder()
 {
-    if (base->refCount.deref() == 0)
+    if (!base->refCount.deref())
         delete base;
 }
 
index 47ddc3e..c8cd53f 100644 (file)
@@ -2372,7 +2372,7 @@ QFontCache::~QFontCache()
         EngineDataCache::ConstIterator it = engineDataCache.constBegin(),
                                  end = engineDataCache.constEnd();
         while (it != end) {
-            if (it.value()->ref.deref() == 0)
+            if (!it.value()->ref.deref())
                 delete it.value();
             else
                 FC_DEBUG("QFontCache::~QFontCache: engineData %p still has refcount %d",
@@ -2400,7 +2400,7 @@ void QFontCache::clear()
 
     for (EngineCache::Iterator it = engineCache.begin(), end = engineCache.end();
          it != end; ++it) {
-        if (it->data->ref.deref() == 0) {
+        if (!it->data->ref.deref()) {
             delete it->data;
             it->data = 0;
         }