[mythtv] [patch] Backtrace for SEGV while editing recording

William Uther willu.mailingLists at cse.unsw.edu.au
Sun Jun 5 03:45:24 UTC 2005


On 05/06/2005, at 2:00 AM, mythtv-dev-request at mythtv.org wrote:

>
> Stuart Auchterlonie wrote:
>
>> I've been having a look into this and believe I've found the problem.
>>
>> Valgrind pointed me in the right direction, namely that in

Valgrind is a wonderful thing :).

>> void OSDTypeImage::Reinit(float wmult, float hmult)
>> {
>>     int x = (int)(m_displaypos.x() * wmult / m_wmult);
>>     int y = (int)(m_displaypos.y() * hmult / m_hmult);
>> ....
>> (osdtypes.cpp)
>>
>>
>> Both m_wmult & m_hmult were being used without being initialized.
>>
>> I've attached a patch to fix the problem.
>>
>> Could everyone give it a go and see if it works for them....

Just a quick note... it looks like you're patch removes almost all  
the references to m_wmult and m_hmult from OSDTypeImage.  It isn't  
that much more to remove all of them (from OSDTypeImage, I've left  
them in OSDSet) and it makes things cleaner. :)

Will       :-}

Index: osdtypes.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/osdtypes.cpp,v
retrieving revision 1.60
diff -u -r1.60 osdtypes.cpp
--- osdtypes.cpp    3 May 2005 07:23:55 -0000    1.60
+++ osdtypes.cpp    5 Jun 2005 02:23:35 -0000
@@ -195,7 +195,7 @@
          }
          else if (OSDTypeImage *item = dynamic_cast<OSDTypeImage*> 
(type))
          {
-            item->Reinit(wmult, hmult);
+            item->Reinit(wchange, hchange, wmult, hmult);
          }
          else if (OSDTypeBox *item = dynamic_cast<OSDTypeBox*>(type))
          {
@@ -709,8 +709,6 @@
      m_scalew = scalew;
      m_scaleh = scaleh;
-    m_wmult = wmult;
-    m_hmult = hmult;
      LoadImage(filename, wmult, hmult, scalew, scaleh);
}
@@ -796,18 +794,15 @@
      m_name = name;
}
-void OSDTypeImage::Reinit(float wmult, float hmult)
+void OSDTypeImage::Reinit(float wchange, float hchange, float wmult,  
float hmult)
{
-    int x = (int)(m_displaypos.x() * wmult / m_wmult);
-    int y = (int)(m_displaypos.y() * hmult / m_hmult);
+    int x = (int)(m_displaypos.x() * wchange);
+    int y = (int)(m_displaypos.y() * hchange);
      m_displaypos.setX(x);
      m_displaypos.setY(y);
-    m_wmult = wmult;
-    m_hmult = hmult;
-
-    LoadImage(m_filename, m_wmult, m_hmult, m_scalew, m_scaleh);
+    LoadImage(m_filename, wmult, hmult, m_scalew, m_scaleh);
}
void OSDTypeImage::LoadImage(const QString &filename, float wmult,  
float hmult,
@@ -1080,7 +1075,7 @@
      m_displayrect = QRect(x, y, width, height);
-    OSDTypeImage::Reinit(wmult, hmult);
+    OSDTypeImage::Reinit(wchange, hchange, wmult, hmult);
}
void OSDTypePosSlider::SetPosition(int pos)
@@ -1129,7 +1124,7 @@
      m_displayrect = QRect(x, y, width, height);
-    OSDTypeImage::Reinit(wmult, hmult);
+    OSDTypeImage::Reinit(wchange, hchange, wmult, hmult);
}
void OSDTypeFillSlider::SetPosition(int pos)
@@ -1236,9 +1231,6 @@
      if (m_ralpha)
          delete [] m_ralpha;
-    m_wmult = wmult;
-    m_hmult = hmult;
-
      LoadImage(m_redname, wmult, hmult, m_scalew, m_scaleh);
      if (m_isvalid)
      {
@@ -1654,7 +1646,7 @@
void OSDTypePositionImage::Reinit(float wchange, float hchange, float  
wmult,
                                    float hmult)
{
-    OSDTypeImage::Reinit(wmult, hmult);
+    OSDTypeImage::Reinit(wchange, hchange, wmult, hmult);
      for (int i = 0; i < m_numpositions; i++)
      {
Index: osdtypes.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/osdtypes.h,v
retrieving revision 1.27
diff -u -r1.27 osdtypes.h
--- osdtypes.h    3 May 2005 07:23:55 -0000    1.27
+++ osdtypes.h    5 Jun 2005 02:23:35 -0000
@@ -226,7 +226,7 @@
      virtual ~OSDTypeImage();
      void SetName(const QString &name);
-    void Reinit(float wmult, float hmult);
+    void Reinit(float wchange, float hchange, float wmult, float  
hmult);
      void LoadImage(const QString &filename, float wmult, float hmult,
                     int scalew = -1, int scaleh = -1);
@@ -262,7 +262,6 @@
      unsigned char *m_alpha;
      int m_scalew, m_scaleh;
-    float m_wmult, m_hmult;
      int m_drawwidth;
      bool m_onlyusefirst;



More information about the mythtv-dev mailing list