Ticket #5676: libs_libmythui-uninit.patch

File libs_libmythui-uninit.patch, 9.1 KB (added by Erik Hovland <erik@…>, 16 years ago)

Initializes member variables in several different ctors.

  • mythtv/libs/libmythui/jsmenu.cpp

    Attempts to fix defects associated to initialization of
    
    From: Erik Hovland <erik@hovland.org>
    
    member variables in ctors
    ---
    
     mythtv/libs/libmythui/jsmenu.cpp            |   12 +++---
     mythtv/libs/libmythui/lirc.cpp              |    8 ++--
     mythtv/libs/libmythui/mythgenerictree.cpp   |   25 +++++--------
     mythtv/libs/libmythui/mythgenerictree.h     |    2 +
     mythtv/libs/libmythui/mythuiprogressbar.cpp |   14 ++-----
     mythtv/libs/libmythui/mythuiprogressbar.h   |    2 +
     mythtv/libs/libmythui/mythuitext.cpp        |   52 +++++++++++++--------------
     mythtv/libs/libmythui/mythuiwebbrowser.cpp  |   20 +++++-----
     8 files changed, 60 insertions(+), 75 deletions(-)
    
    diff --git a/mythtv/libs/libmythui/jsmenu.cpp b/mythtv/libs/libmythui/jsmenu.cpp
    index c6c29fc..b351ac9 100644
    a b using namespace std; 
    5151** JoystickMenuThread Constructor
    5252**--------------------------------------------------------------------------*/
    5353JoystickMenuThread::JoystickMenuThread(QObject *main_window)
    54                   : QThread()
     54    : QThread(),
     55      mainWindow(main_window), devicename(""),
     56      fd(-1),                  button_count(0),
     57      axes_count(0),           buttons(NULL),
     58      axes(NULL),              bStop(false)
    5559{
    56     mainWindow = main_window;
    57 
    58     fd = -1;
    59     axes = NULL;
    60     buttons = NULL;
    61     bStop = false;
    6260}
    6361
    6462/*----------------------------------------------------------------------------
  • mythtv/libs/libmythui/lirc.cpp

    diff --git a/mythtv/libs/libmythui/lirc.cpp b/mythtv/libs/libmythui/lirc.cpp
    index 11ac95f..fd40a64 100644
    a b  
    2424 */
    2525
    2626LircThread::LircThread(QObject *main_window)
    27           : QThread()
     27    : QThread(),
     28      lircConfig(NULL), mainWindow(main_window),
     29      bStop(false),     fd(-1),
     30      external_app("")
    2831{
    29     mainWindow = main_window;
    30     bStop = false;
    31     lircConfig = NULL;
    3232}
    3333
    3434int LircThread::Init(const QString &config_file, const QString &program,
  • mythtv/libs/libmythui/mythgenerictree.cpp

    diff --git a/mythtv/libs/libmythui/mythgenerictree.cpp b/mythtv/libs/libmythui/mythgenerictree.cpp
    index c8dc997..d53138c 100644
    a b class SortableMythGenericTreeList : public QList<MythGenericTree*> 
    9999};
    100100
    101101///////////////////////////////////////////////////////
     102// Use 6 here, because we know that's what mythmusic wants (limits resizing)
     103const unsigned int MythGenericTree::kDefaultVectorSize = 6;
    102104
    103105MythGenericTree::MythGenericTree(const QString &a_string, int an_int,
    104                          bool selectable_flag)
     106                                 bool selectable_flag)
     107    : m_string(a_string),       m_int(an_int),
     108      m_subnodes(new SortableMythGenericTreeList),
     109      m_ordered_subnodes(new SortableMythGenericTreeList),
     110      m_flatenedSubnodes(new SortableMythGenericTreeList),
     111      m_selected_subnode(NULL), m_attributes(new IntVector(kDefaultVectorSize)),
     112      m_parent(NULL),           m_selectable(selectable_flag),
     113      m_visible(false),         m_currentOrderingIndex(-1)
    105114{
    106     m_subnodes = new SortableMythGenericTreeList;
    107     m_ordered_subnodes = new SortableMythGenericTreeList;
    108     m_flatenedSubnodes = new SortableMythGenericTreeList;
    109 
    110     m_parent = NULL;
    111     m_selected_subnode = NULL;
    112     m_currentOrderingIndex = -1;
    113 
    114     // Use 6 here, because we know that's what mythmusic wants (limits resizing)
    115     m_attributes = new IntVector(6);
    116 
    117     m_string = a_string;
    118     m_int = an_int;
    119     m_selectable = selectable_flag;
    120115}
    121116
    122117MythGenericTree::~MythGenericTree()
  • mythtv/libs/libmythui/mythgenerictree.h

    diff --git a/mythtv/libs/libmythui/mythgenerictree.h b/mythtv/libs/libmythui/mythgenerictree.h
    index a539fe0..f2bcc89 100644
    a b class MPUBLIC MythGenericTree 
    101101  private:
    102102    void reorderSubnodes(void);
    103103
     104    static const unsigned int kDefaultVectorSize;
     105
    104106    QString m_string;
    105107    int m_int;
    106108    QVariant m_data;
  • mythtv/libs/libmythui/mythuiprogressbar.cpp

    diff --git a/mythtv/libs/libmythui/mythuiprogressbar.cpp b/mythtv/libs/libmythui/mythuiprogressbar.cpp
    index 5716c01..6c98ffa 100644
    a b  
    1010#include "mythuiprogressbar.h"
    1111
    1212MythUIProgressBar::MythUIProgressBar(MythUIType *parent, const QString &name)
    13            : MythUIType(parent, name)
     13    : MythUIType(parent, name),
     14      m_layout(LayoutHorizontal), m_effect(EffectReveal),
     15      m_initialized(false),       m_total(0),
     16      m_start(0),                 m_current(0)
    1417{
    15     m_layout = LayoutHorizontal;
    16     m_effect = EffectReveal;
    17 
    18     m_total = m_start = m_current = 0;
    19 }
    20 
    21 MythUIProgressBar::~MythUIProgressBar()
    22 {
    23 
    2418}
    2519
    2620bool MythUIProgressBar::ParseElement(QDomElement &element)
  • mythtv/libs/libmythui/mythuiprogressbar.h

    diff --git a/mythtv/libs/libmythui/mythuiprogressbar.h b/mythtv/libs/libmythui/mythuiprogressbar.h
    index b50c37f..66e3686 100644
    a b class MythUIProgressBar : public MythUIType 
    1515{
    1616  public:
    1717    MythUIProgressBar(MythUIType *parent, const QString &name);
    18    ~MythUIProgressBar();
     18   ~MythUIProgressBar() { }
    1919
    2020    enum LayoutType { LayoutVertical, LayoutHorizontal };
    2121    enum EffectType { EffectReveal, EffectSlide, EffectAnimate };
  • mythtv/libs/libmythui/mythuitext.cpp

    diff --git a/mythtv/libs/libmythui/mythuitext.cpp b/mythtv/libs/libmythui/mythuitext.cpp
    index ed479ed..b177f9e 100644
    a b  
    1212#include "compat.h"
    1313
    1414MythUIText::MythUIText(MythUIType *parent, const QString &name)
    15           : MythUIType(parent, name)
     15    : MythUIType(parent, name),
     16      m_Justification(Qt::AlignLeft | Qt::AlignTop), m_OrigDisplayRect(),
     17      m_AltDisplayRect(),                            m_drawRect(),
     18      m_Message(""),                                 m_CutMessage(""),
     19      m_DefaultMessage(""),                          m_Cutdown(true),
     20      m_Font(new MythFontProperties()),              m_colorCycling(false),
     21      m_startColor(),                                m_endColor(),
     22      m_numSteps(0),                                 m_curStep(0),
     23      curR(0.0),              curG(0.0),             curB(0.0),
     24      incR(0.0),              incG(0.0),             incB(0.0)
    1625{
    17     m_Message = m_DefaultMessage = "";
    18 
    19     m_Font = new MythFontProperties();
    20 
    21     m_OrigDisplayRect = m_AltDisplayRect = m_Area = m_drawRect = MythRect();
    22 
    23     m_Cutdown = true;
    24     m_CutMessage = "";
    25 
    26     m_Justification = (Qt::AlignLeft | Qt::AlignTop);
    27 
    28     m_colorCycling = false;
     26    // This is a part of a parent object (it should be set in that ctor)
     27    m_Area = MythRect();
    2928}
    3029
    3130MythUIText::MythUIText(const QString &text, const MythFontProperties &font,
    3231                       QRect displayRect, QRect altDisplayRect,
    3332                       MythUIType *parent, const QString &name)
    34           : MythUIType(parent, name)
     33    : MythUIType(parent, name),
     34      m_Justification(Qt::AlignLeft | Qt::AlignTop),
     35      m_OrigDisplayRect(displayRect), m_AltDisplayRect(altDisplayRect),
     36      m_drawRect(displayRect),        m_Message(text),
     37      m_CutMessage(""),               m_DefaultMessage(text),
     38      m_Cutdown(true),                m_Font(new MythFontProperties()),
     39      m_colorCycling(false),          m_startColor(),
     40      m_endColor(),                   m_numSteps(0),
     41      m_curStep(0),
     42      curR(0.0),      curG(0.0),      curB(0.0),
     43      incR(0.0),      incG(0.0),      incB(0.0)
    3544{
    36     m_Message = text;
    37     m_DefaultMessage = text;
    38 
    39     m_Font = new MythFontProperties();
    4045    *m_Font = font;
    41 
    42     m_OrigDisplayRect = m_Area = m_drawRect = displayRect;
    43     m_AltDisplayRect = altDisplayRect;
    44 
    45     m_Cutdown = true;
    46     m_CutMessage = "";
    47     m_Justification = (Qt::AlignLeft | Qt::AlignTop);
    48 
    49     m_colorCycling = false;
     46    // This is a part of a parent object (it should be set in that ctor)
     47    m_Area = displayRect;
    5048}
    5149
    5250MythUIText::~MythUIText()
  • mythtv/libs/libmythui/mythuiwebbrowser.cpp

    diff --git a/mythtv/libs/libmythui/mythuiwebbrowser.cpp b/mythtv/libs/libmythui/mythuiwebbrowser.cpp
    index a952b0c..8e5912d 100644
    a b void MythWebView::handleUnsupportedContent(QNetworkReply *reply) 
    147147 *  \param name the name of this widget
    148148 */
    149149MythUIWebBrowser::MythUIWebBrowser(MythUIType *parent, const QString &name)
    150                 : MythUIType(parent, name)
     150    : MythUIType(parent, name),
     151#ifdef USING_QTWEBKIT
     152      m_browser(NULL),
     153#endif
     154      m_image(NULL),         m_active(false),
     155      m_initialized(false),  m_zoom(1.0),
     156      m_bgColor("White"),    m_inputToggled(false),
     157      m_lastMouseAction(""), m_mouseKeyCount(0),
     158      m_lastMouseActionTime()
    151159{
    152     m_zoom = 1.0;
    153     m_bgColor = QColor("white");
    154     m_image = NULL;
    155     m_browser = NULL;
    156 
    157     m_initialized = false;
    158     m_active = false;
    159     m_inputToggled = false;
    160 
    161160    SetCanTakeFocus(true);
    162161}
    163162
    164163void MythUIWebBrowser::Finalize(void)
    165164{
    166165    Init();
    167 
    168166    MythUIType::Finalize();
    169167}
    170168