Qt: Fix crash with Vulkan renderer when unsupported

This commit is contained in:
Connor McLaughlin 2020-12-01 01:17:26 +10:00
parent 37c9e69b3e
commit bccecdbf18
2 changed files with 4 additions and 3 deletions

View file

@ -129,7 +129,6 @@ QtDisplayWidget* MainWindow::createDisplay(QThread* worker_thread, const QString
{ {
reportError(QStringLiteral("Failed to get window info from widget")); reportError(QStringLiteral("Failed to get window info from widget"));
destroyDisplayWidget(); destroyDisplayWidget();
delete m_host_display;
m_host_display = nullptr; m_host_display = nullptr;
return nullptr; return nullptr;
} }
@ -138,7 +137,6 @@ QtDisplayWidget* MainWindow::createDisplay(QThread* worker_thread, const QString
{ {
reportError(tr("Failed to create host display device context.")); reportError(tr("Failed to create host display device context."));
destroyDisplayWidget(); destroyDisplayWidget();
delete m_host_display;
m_host_display = nullptr; m_host_display = nullptr;
return nullptr; return nullptr;
} }
@ -245,6 +243,9 @@ void MainWindow::displaySizeRequested(qint32 width, qint32 height)
void MainWindow::destroyDisplay() void MainWindow::destroyDisplay()
{ {
if (!m_host_display)
return;
DebugAssert(m_host_display && m_display_widget); DebugAssert(m_host_display && m_display_widget);
m_host_display = nullptr; m_host_display = nullptr;
destroyDisplayWidget(); destroyDisplayWidget();

View file

@ -486,7 +486,7 @@ bool QtHostInterface::AcquireHostDisplay()
if (!display_widget || !m_display->HasRenderDevice()) if (!display_widget || !m_display->HasRenderDevice())
{ {
emit destroyDisplayRequested(); emit destroyDisplayRequested();
m_display = nullptr; m_display.reset();
return false; return false;
} }