prevent use after free through focusOutEvent when window is closed
This commit is contained in:
parent
2179ca2a41
commit
2eb6d44c2c
|
@ -780,6 +780,10 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
|||
Config::Save();
|
||||
|
||||
emuInstance->deleteWindow(windowID, false);
|
||||
|
||||
// emuInstance may be deleted
|
||||
// prevent use after free from us
|
||||
emuInstance = nullptr;
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
|
@ -970,6 +974,9 @@ void MainWindow::focusInEvent(QFocusEvent* event)
|
|||
|
||||
void MainWindow::focusOutEvent(QFocusEvent* event)
|
||||
{
|
||||
// focusOutEvent is called through the window close event handler
|
||||
// prevent use after free
|
||||
if (emuInstance)
|
||||
emuInstance->audioMute();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue