[mythtv] BUG in mythfrontend MixerControl

Geoffrey Hausheer ou401cru02 at sneakemail.com
Tue Sep 16 15:48:13 EDT 2003


This bug is brought to you by valgrind...
in programs/mythfrontend/globalsettings.cpp, valgrind flags the following
code as causing read of uninitialized data:
line 73:
const char* MixerControl::controlNames[] = { QObject::tr("PCM"),
        QObject::tr("Master") };
Sure enough, this doesn't allocate controlNames correctly.  This was
obviously changed during the translation.  Something like the following
will work much better:

----

class MixerControl: public ComboBoxSetting, public GlobalSetting {
public:
    MixerControl();
protected:
    static const char* controls[];
};

const char* MixerControl::controls[] = { "PCM",
                                         "Master" };

MixerControl::MixerControl():
    ComboBoxSetting(true),
    GlobalSetting("MixerControl") {

    setLabel("Mixer Controls");
    for(unsigned int i = 0; i < sizeof(controls) / sizeof(char*); ++i) {
        addSelection(tr(controls[i]), controls[i]);
    }
    setHelpText(QObject::tr("Changing the volume adjusts the selected
    mixer."));
}

----------

.Geoff


More information about the mythtv-dev mailing list