mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
fix freeze when starting new emu instance while using OpenGL
This commit is contained in:
parent
24ca1a5fdb
commit
e6f0d77aa0
@ -201,7 +201,7 @@ void EmuInstance::createWindow()
|
|||||||
emuThread->attachWindow(win);
|
emuThread->attachWindow(win);
|
||||||
|
|
||||||
// if creating a secondary window, we may need to initialize its OpenGL context here
|
// if creating a secondary window, we may need to initialize its OpenGL context here
|
||||||
if (win->hasOpenGL() && (win != topWindow))
|
if (win->hasOpenGL() && (id != 0))
|
||||||
emuThread->initContext(id);
|
emuThread->initContext(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -749,8 +749,10 @@ bool ScreenPanelGL::createContext()
|
|||||||
|
|
||||||
// if our parent window is parented to another window, we will
|
// if our parent window is parented to another window, we will
|
||||||
// share our OpenGL context with that window
|
// share our OpenGL context with that window
|
||||||
|
MainWindow* ourwin = (MainWindow*)parentWidget();
|
||||||
MainWindow* parentwin = (MainWindow*)parentWidget()->parentWidget();
|
MainWindow* parentwin = (MainWindow*)parentWidget()->parentWidget();
|
||||||
if (parentwin)
|
//if (parentwin)
|
||||||
|
if (ourwin->getWindowID() != 0)
|
||||||
{
|
{
|
||||||
if (windowinfo.has_value())
|
if (windowinfo.has_value())
|
||||||
if (glContext = parentwin->getOGLContext()->CreateSharedContext(*windowinfo))
|
if (glContext = parentwin->getOGLContext()->CreateSharedContext(*windowinfo))
|
||||||
|
@ -2147,9 +2147,14 @@ void MainWindow::onEmuReset()
|
|||||||
|
|
||||||
void MainWindow::onUpdateVideoSettings(bool glchange)
|
void MainWindow::onUpdateVideoSettings(bool glchange)
|
||||||
{
|
{
|
||||||
MainWindow* parentwin = (MainWindow*)parentWidget();
|
if (windowID != 0)
|
||||||
if (parentwin)
|
{
|
||||||
return parentwin->onUpdateVideoSettings(glchange);
|
MainWindow* parentwin = (MainWindow*)parentWidget();
|
||||||
|
if (parentwin)
|
||||||
|
parentwin->onUpdateVideoSettings(glchange);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool hadOGL = hasOGL;
|
bool hadOGL = hasOGL;
|
||||||
if (glchange)
|
if (glchange)
|
||||||
@ -2166,12 +2171,15 @@ void MainWindow::onUpdateVideoSettings(bool glchange)
|
|||||||
{
|
{
|
||||||
if (hasOGL) emuThread->initContext(windowID);
|
if (hasOGL) emuThread->initContext(windowID);
|
||||||
|
|
||||||
auto childwins = findChildren<MainWindow*>(nullptr, Qt::FindDirectChildrenOnly);
|
if (windowID == 0)
|
||||||
for (auto child : childwins)
|
|
||||||
{
|
{
|
||||||
if (hadOGL) emuThread->deinitContext(child->windowID);
|
auto childwins = findChildren<MainWindow *>(nullptr, Qt::FindDirectChildrenOnly);
|
||||||
child->createScreenPanel();
|
for (auto child: childwins)
|
||||||
if (hasOGL) emuThread->initContext(child->windowID);
|
{
|
||||||
|
if (hadOGL) emuThread->deinitContext(child->windowID);
|
||||||
|
child->createScreenPanel();
|
||||||
|
if (hasOGL) emuThread->initContext(child->windowID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emuThread->emuUnpause();
|
emuThread->emuUnpause();
|
||||||
|
@ -110,7 +110,7 @@ public:
|
|||||||
|
|
||||||
EmuInstance* getEmuInstance() { return emuInstance; }
|
EmuInstance* getEmuInstance() { return emuInstance; }
|
||||||
Config::Table& getWindowConfig() { return windowCfg; }
|
Config::Table& getWindowConfig() { return windowCfg; }
|
||||||
int getID() { return windowID; }
|
int getWindowID() { return windowID; }
|
||||||
|
|
||||||
bool winHasMenu() { return hasMenu; }
|
bool winHasMenu() { return hasMenu; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user