All pastes #1621272 Raw Edit

Miscellany

public text v1 · immutable
#1621272 ·published 2009-10-15 03:03 UTC
rendered paste body
Index: libs/libmythui/mythuiimage.cpp
===================================================================
--- libs/libmythui/mythuiimage.cpp	(revision 22464)
+++ libs/libmythui/mythuiimage.cpp	(working copy)
@@ -180,7 +180,8 @@
     while (!m_Images.isEmpty())
     {
         QHash<int, MythImage*>::iterator it = m_Images.begin();
-        (*it)->DownRef();
+        if (*it)
+            (*it)->DownRef();
         m_Images.remove(it.key());
     }
 }
@@ -353,6 +354,13 @@
     for (it = images.begin(); it != images.end(); ++it)
     {
         MythImage *im = (*it);
+        if (!im)
+        {
+            QMutexLocker locker(&m_ImagesLock);
+            m_Images[m_Images.size()] = im;
+            continue;
+        }
+
         im->UpRef();
 
         if (!m_ForceSize.isNull())
@@ -866,9 +874,14 @@
         int alpha = CalcAlpha(alphaMod);
 
         MythImage *currentImage = m_Images[m_CurPos];
-        currentImage->UpRef();
+        if (currentImage)
+            currentImage->UpRef();
         m_ImagesLock.unlock();
         d->m_UpdateLock.unlock();
+
+        if (!currentImage)
+            return;
+
         d->m_UpdateLock.lockForRead();
 
         QRect currentImageArea = currentImage->rect();