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) : QIODevice(parent)
, m_context(nullptr) , m_context(nullptr)
, m_drift(0) , m_drift(0)
, m_ratio(1.f)
{ {
setOpenMode(ReadOnly); setOpenMode(ReadOnly);
} }
void AudioDevice::setFormat(const QAudioFormat& format) { void AudioDevice::setFormat(const QAudioFormat& format) {
if (!GBAThreadIsActive(m_context)) { if (!m_context || !GBAThreadIsActive(m_context)) {
return; return;
} }
#if RESAMPLE_LIBRARY == RESAMPLE_NN #if RESAMPLE_LIBRARY == RESAMPLE_NN

View File

@ -48,6 +48,8 @@ AudioProcessor* AudioProcessor::create() {
AudioProcessor::AudioProcessor(QObject* parent) AudioProcessor::AudioProcessor(QObject* parent)
: 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() { void AudioProcessorQt::start() {
if (!input()) {
return;
}
if (!m_device) { if (!m_device) {
m_device = new AudioDevice(this); m_device = new AudioDevice(this);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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