don't segfault on closing
This commit is contained in:
parent
cdaa52256f
commit
dbd75f8ae4
|
@ -464,15 +464,12 @@ void EmuThread::run()
|
||||||
videoSettings.GL_ScaleFactor = Config::GL_ScaleFactor;
|
videoSettings.GL_ScaleFactor = Config::GL_ScaleFactor;
|
||||||
videoSettings.GL_BetterPolygons = Config::GL_BetterPolygons;
|
videoSettings.GL_BetterPolygons = Config::GL_BetterPolygons;
|
||||||
|
|
||||||
bool hasOGL = mainWindow->hasOGL;
|
if (mainWindow->hasOGL)
|
||||||
#ifdef OGLRENDERER_ENABLED
|
|
||||||
if (hasOGL)
|
|
||||||
{
|
{
|
||||||
initOpenGL();
|
initOpenGL();
|
||||||
videoRenderer = Config::_3DRenderer;
|
videoRenderer = Config::_3DRenderer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
videoRenderer = 0;
|
videoRenderer = 0;
|
||||||
}
|
}
|
||||||
|
@ -547,32 +544,26 @@ void EmuThread::run()
|
||||||
// update render settings if needed
|
// update render settings if needed
|
||||||
if (videoSettingsDirty)
|
if (videoSettingsDirty)
|
||||||
{
|
{
|
||||||
if (hasOGL != mainWindow->hasOGL)
|
if (oglContext)
|
||||||
{
|
{
|
||||||
hasOGL = mainWindow->hasOGL;
|
oglContext->SetSwapInterval(Config::ScreenVSync ? Config::ScreenVSyncInterval : 0);
|
||||||
|
videoRenderer = Config::_3DRenderer;
|
||||||
|
}
|
||||||
#ifdef OGLRENDERER_ENABLED
|
#ifdef OGLRENDERER_ENABLED
|
||||||
if (hasOGL)
|
|
||||||
videoRenderer = Config::_3DRenderer;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
videoRenderer = 0;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
videoRenderer = hasOGL ? Config::_3DRenderer : 0;
|
videoRenderer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
videoRenderer = oglContext ? Config::_3DRenderer : 0;
|
||||||
|
|
||||||
videoSettingsDirty = false;
|
videoSettingsDirty = false;
|
||||||
|
|
||||||
videoSettings.Soft_Threaded = Config::Threaded3D != 0;
|
videoSettings.Soft_Threaded = Config::Threaded3D != 0;
|
||||||
videoSettings.GL_ScaleFactor = Config::GL_ScaleFactor;
|
videoSettings.GL_ScaleFactor = Config::GL_ScaleFactor;
|
||||||
videoSettings.GL_BetterPolygons = Config::GL_BetterPolygons;
|
videoSettings.GL_BetterPolygons = Config::GL_BetterPolygons;
|
||||||
|
|
||||||
if (hasOGL)
|
|
||||||
{
|
|
||||||
oglContext->SetSwapInterval(Config::ScreenVSync ? Config::ScreenVSyncInterval : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
GPU::SetRenderSettings(videoRenderer, videoSettings);
|
GPU::SetRenderSettings(videoRenderer, videoSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,7 +620,7 @@ void EmuThread::run()
|
||||||
if (ROMManager::GBASave)
|
if (ROMManager::GBASave)
|
||||||
ROMManager::GBASave->CheckFlush();
|
ROMManager::GBASave->CheckFlush();
|
||||||
|
|
||||||
if (!hasOGL)
|
if (!oglContext)
|
||||||
{
|
{
|
||||||
FrontBufferLock.lock();
|
FrontBufferLock.lock();
|
||||||
FrontBuffer = GPU::FrontBuffer;
|
FrontBuffer = GPU::FrontBuffer;
|
||||||
|
@ -752,7 +743,7 @@ void EmuThread::run()
|
||||||
NDS::DeInit();
|
NDS::DeInit();
|
||||||
//Platform::LAN_DeInit();
|
//Platform::LAN_DeInit();
|
||||||
|
|
||||||
if (hasOGL)
|
if (oglContext)
|
||||||
deinitOpenGL();
|
deinitOpenGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1831,6 +1822,15 @@ MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::closeEvent(QCloseEvent* event)
|
||||||
|
{
|
||||||
|
printf("close event\n");
|
||||||
|
emuThread->emuPause();
|
||||||
|
emuThread->deinitContext();
|
||||||
|
|
||||||
|
QMainWindow::closeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::createScreenPanel()
|
void MainWindow::createScreenPanel()
|
||||||
{
|
{
|
||||||
hasOGL = (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0);
|
hasOGL = (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0);
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
#include <QCloseEvent>
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
|
@ -325,6 +326,8 @@ private slots:
|
||||||
void onFullscreenToggled();
|
void onFullscreenToggled();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void closeEvent(QCloseEvent* event);
|
||||||
|
|
||||||
QStringList currentROM;
|
QStringList currentROM;
|
||||||
QStringList currentGBAROM;
|
QStringList currentGBAROM;
|
||||||
QList<QString> recentFileList;
|
QList<QString> recentFileList;
|
||||||
|
|
Loading…
Reference in New Issue