all repos — mgba @ 5e7333e20f63989b81ede8fd456eb522a1db90d6

mGBA Game Boy Advance Emulator

Qt: Don't double-load display driver
Vicki Pfau vi@endrift.com
Tue, 02 Oct 2018 13:03:41 -0700
commit

5e7333e20f63989b81ede8fd456eb522a1db90d6

parent

18fc2cbdb222d94424044fa3155964f534c4fab4

1 files changed, 17 insertions(+), 9 deletions(-)

jump to
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -81,7 +81,6 @@ setFocusPolicy(Qt::StrongFocus);

setAcceptDrops(true); setAttribute(Qt::WA_DeleteOnClose); updateTitle(); - reloadDisplayDriver(); m_logo.setDevicePixelRatio(m_screenWidget->devicePixelRatio()); m_logo = m_logo; // Free memory left over in old pixmap

@@ -238,8 +237,10 @@ m_audioProcessor->requestSampleRate(opts->sampleRate);

} m_display->resizeContext(); } - m_display->lockAspectRatio(opts->lockAspectRatio); - m_display->filter(opts->resampleVideo); + if (m_display) { + m_display->lockAspectRatio(opts->lockAspectRatio); + m_display->filter(opts->resampleVideo); + } m_inputController.setScreensaverSuspendable(opts->suspendScreensaver); }

@@ -600,9 +601,7 @@ if (m_fullscreenOnStart) {

enterFullScreen(); m_fullscreenOnStart = false; } - if (m_display) { - reloadDisplayDriver(); - } + reloadDisplayDriver(); } void Window::closeEvent(QCloseEvent* event) {

@@ -701,6 +700,9 @@ m_config->updateOption("lockIntegerScaling");

m_config->updateOption("lockAspectRatio"); if (m_savedScale > 0) { resizeFrame(size * m_savedScale); + } + if (!m_display) { + reloadDisplayDriver(); } attachWidget(m_display.get()); m_display->setMinimumSize(size);

@@ -1382,7 +1384,9 @@

ConfigOption* lockAspectRatio = m_config->addOption("lockAspectRatio"); lockAspectRatio->addBoolean(tr("Lock aspect ratio"), avMenu); lockAspectRatio->connect([this](const QVariant& value) { - m_display->lockAspectRatio(value.toBool()); + if (m_display) { + m_display->lockAspectRatio(value.toBool()); + } if (m_controller) { m_screenWidget->setLockAspectRatio(value.toBool()); }

@@ -1392,7 +1396,9 @@

ConfigOption* lockIntegerScaling = m_config->addOption("lockIntegerScaling"); lockIntegerScaling->addBoolean(tr("Force integer scaling"), avMenu); lockIntegerScaling->connect([this](const QVariant& value) { - m_display->lockIntegerScaling(value.toBool()); + if (m_display) { + m_display->lockIntegerScaling(value.toBool()); + } if (m_controller) { m_screenWidget->setLockIntegerScaling(value.toBool()); }

@@ -1402,7 +1408,9 @@

ConfigOption* resampleVideo = m_config->addOption("resampleVideo"); resampleVideo->addBoolean(tr("Bilinear filtering"), avMenu); resampleVideo->connect([this](const QVariant& value) { - m_display->filter(value.toBool()); + if (m_display) { + m_display->filter(value.toBool()); + } }, this); m_config->updateOption("resampleVideo");