Qt: Fix a load of uninitialized members
Jeffrey Pfau jeffrey@endrift.com
Wed, 22 Apr 2015 20:18:54 -0700
10 files changed,
22 insertions(+),
8 deletions(-)
jump to
M
src/platform/qt/AudioDevice.cpp
→
src/platform/qt/AudioDevice.cpp
@@ -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
M
src/platform/qt/AudioProcessor.cpp
→
src/platform/qt/AudioProcessor.cpp
@@ -48,6 +48,8 @@ }
AudioProcessor::AudioProcessor(QObject* parent) : QObject(parent) + , m_context(nullptr) + , m_samples(GBA_AUDIO_SAMPLES) { }
M
src/platform/qt/AudioProcessorQt.cpp
→
src/platform/qt/AudioProcessorQt.cpp
@@ -33,6 +33,10 @@ }
} void AudioProcessorQt::start() { + if (!input()) { + return; + } + if (!m_device) { m_device = new AudioDevice(this); }
M
src/platform/qt/AudioProcessorSDL.cpp
→
src/platform/qt/AudioProcessorSDL.cpp
@@ -22,6 +22,10 @@ GBASDLDeinitAudio(&m_audio);
} void AudioProcessorSDL::start() { + if (!input()) { + return; + } + if (m_audio.thread) { GBASDLResumeAudio(&m_audio); } else {
M
src/platform/qt/DisplayGL.cpp
→
src/platform/qt/DisplayGL.cpp
@@ -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::framePosted(const uint32_t* buffer) { - if (buffer) { + if (m_started && buffer) { m_painter->setBacking(buffer); } }@@ -128,6 +131,7 @@ : QGLWidget(format, parent)
, m_drawTimer(nullptr) , m_lockAspectRatio(false) , m_filter(false) + , m_context(nullptr) { setMinimumSize(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS); m_size = parent->size();
M
src/platform/qt/DisplayQt.cpp
→
src/platform/qt/DisplayQt.cpp
@@ -17,8 +17,7 @@ , m_filter(false)
{ } -void DisplayQt::startDrawing(GBAThread* context) { - m_context = context; +void DisplayQt::startDrawing(GBAThread*) { } void DisplayQt::lockAspectRatio(bool lock) {
M
src/platform/qt/DisplayQt.h
→
src/platform/qt/DisplayQt.h
@@ -35,7 +35,6 @@ protected:
virtual void paintEvent(QPaintEvent*) override; private: - GBAThread* m_context; QImage m_backing; bool m_lockAspectRatio; bool m_filter;
M
src/platform/qt/KeyEditor.cpp
→
src/platform/qt/KeyEditor.cpp
@@ -15,6 +15,7 @@
KeyEditor::KeyEditor(QWidget* parent) : QLineEdit(parent) , m_direction(GamepadAxisEvent::NEUTRAL) + , m_button(false) { setAlignment(Qt::AlignCenter); }
M
src/platform/qt/LoadSaveState.h
→
src/platform/qt/LoadSaveState.h
@@ -47,7 +47,6 @@ void triggerState(int slot);
Ui::LoadSaveState m_ui; GameController* m_controller; - InputController* m_inputController; SavestateButton* m_slots[NUM_SLOTS]; LoadSave m_mode;
M
src/platform/qt/LogView.cpp
→
src/platform/qt/LogView.cpp
@@ -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 @@ connect(m_ui.levelGameError, SIGNAL(toggled(bool)), this, SLOT(setLevelGameError(bool)));
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); }