Qt: Fix a load of uninitialized members

This commit is contained in:
Jeffrey Pfau 2015-04-22 20:18:54 -07:00
parent aacab52a84
commit 255242a665
10 changed files with 22 additions and 8 deletions

View File

@ -17,12 +17,13 @@ AudioDevice::AudioDevice(QObject* parent)
: QIODevice(parent)
, m_context(nullptr)
, m_drift(0)
, m_ratio(1.f)
{
setOpenMode(ReadOnly);
}
void AudioDevice::setFormat(const QAudioFormat& format) {
if (!GBAThreadIsActive(m_context)) {
if (!m_context || !GBAThreadIsActive(m_context)) {
return;
}
#if RESAMPLE_LIBRARY == RESAMPLE_NN

View File

@ -48,6 +48,8 @@ AudioProcessor* AudioProcessor::create() {
AudioProcessor::AudioProcessor(QObject* parent)
: QObject(parent)
, m_context(nullptr)
, m_samples(GBA_AUDIO_SAMPLES)
{
}

View File

@ -33,6 +33,10 @@ void AudioProcessorQt::setInput(GBAThread* input) {
}
void AudioProcessorQt::start() {
if (!input()) {
return;
}
if (!m_device) {
m_device = new AudioDevice(this);
}

View File

@ -22,6 +22,10 @@ AudioProcessorSDL::~AudioProcessorSDL() {
}
void AudioProcessorSDL::start() {
if (!input()) {
return;
}
if (m_audio.thread) {
GBASDLResumeAudio(&m_audio);
} else {

View File

@ -32,6 +32,9 @@ DisplayGL::DisplayGL(const QGLFormat& format, QWidget* parent)
: Display(parent)
, m_painter(new Painter(format, this))
, m_started(false)
, m_lockAspectRatio(false)
, m_filter(false)
, m_context(nullptr)
{
}
@ -114,7 +117,7 @@ void DisplayGL::filter(bool filter) {
}
void DisplayGL::framePosted(const uint32_t* buffer) {
if (buffer) {
if (m_started && buffer) {
m_painter->setBacking(buffer);
}
}
@ -128,6 +131,7 @@ Painter::Painter(const QGLFormat& format, QWidget* parent)
, m_drawTimer(nullptr)
, m_lockAspectRatio(false)
, m_filter(false)
, m_context(nullptr)
{
setMinimumSize(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
m_size = parent->size();

View File

@ -17,8 +17,7 @@ DisplayQt::DisplayQt(QWidget* parent)
{
}
void DisplayQt::startDrawing(GBAThread* context) {
m_context = context;
void DisplayQt::startDrawing(GBAThread*) {
}
void DisplayQt::lockAspectRatio(bool lock) {

View File

@ -35,7 +35,6 @@ protected:
virtual void paintEvent(QPaintEvent*) override;
private:
GBAThread* m_context;
QImage m_backing;
bool m_lockAspectRatio;
bool m_filter;

View File

@ -15,6 +15,7 @@ using namespace QGBA;
KeyEditor::KeyEditor(QWidget* parent)
: QLineEdit(parent)
, m_direction(GamepadAxisEvent::NEUTRAL)
, m_button(false)
{
setAlignment(Qt::AlignCenter);
}

View File

@ -47,7 +47,6 @@ private:
Ui::LoadSaveState m_ui;
GameController* m_controller;
InputController* m_inputController;
SavestateButton* m_slots[NUM_SLOTS];
LoadSave m_mode;

View File

@ -12,6 +12,9 @@ using namespace QGBA;
LogView::LogView(QWidget* parent)
: QWidget(parent)
, m_logLevel(0)
, m_lines(0)
, m_lineLimit(DEFAULT_LINE_LIMIT)
{
m_ui.setupUi(this);
connect(m_ui.levelDebug, SIGNAL(toggled(bool)), this, SLOT(setLevelDebug(bool)));
@ -24,8 +27,6 @@ LogView::LogView(QWidget* parent)
connect(m_ui.levelSWI, SIGNAL(toggled(bool)), this, SLOT(setLevelSWI(bool)));
connect(m_ui.clear, SIGNAL(clicked()), this, SLOT(clear()));
connect(m_ui.maxLines, SIGNAL(valueChanged(int)), this, SLOT(setMaxLines(int)));
m_logLevel = 0;
m_lines = 0;
m_ui.maxLines->setValue(DEFAULT_LINE_LIMIT);
}