mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-08-12 05:05:26 +02:00
Fix a crash when closing the main UI (#904)
* Fix a crash when closing the main Ui Also make sure to dispose the OpenAL context to not leak memory when unloading the emulation context. * Improve keys and 'game already running' dialogs * Make sure to dispose the page table and ThreadContext Less memory leaks! * Fix tests * Address gdk's comments
This commit is contained in:
@@ -32,6 +32,8 @@ namespace Ryujinx.Ui
|
||||
|
||||
private static GlScreen _screen;
|
||||
|
||||
private static AutoResetEvent _screenExitStatus = new AutoResetEvent(false);
|
||||
|
||||
private static ListStore _tableStore;
|
||||
|
||||
private static bool _updatingGameTable;
|
||||
@@ -278,7 +280,7 @@ namespace Ryujinx.Ui
|
||||
{
|
||||
if (_gameLoaded)
|
||||
{
|
||||
GtkDialog.CreateErrorDialog("A game has already been loaded. Please close the emulator and try again");
|
||||
GtkDialog.CreateDialog("Ryujinx", "A game has already been loaded", "Please close it first and try again.");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -347,6 +349,8 @@ namespace Ryujinx.Ui
|
||||
|
||||
_emulationContext = device;
|
||||
|
||||
_screenExitStatus.Reset();
|
||||
|
||||
#if MACOS_BUILD
|
||||
CreateGameWindow(device);
|
||||
#else
|
||||
@@ -393,6 +397,8 @@ namespace Ryujinx.Ui
|
||||
|
||||
DiscordIntegrationModule.SwitchToMainMenu();
|
||||
|
||||
_screenExitStatus.Set();
|
||||
|
||||
Application.Invoke(delegate
|
||||
{
|
||||
_stopEmulation.Sensitive = false;
|
||||
@@ -432,12 +438,17 @@ namespace Ryujinx.Ui
|
||||
if (device != null)
|
||||
{
|
||||
UpdateGameMetadata(device.System.TitleIdText);
|
||||
|
||||
if (_screen != null)
|
||||
{
|
||||
_screen.Exit();
|
||||
_screenExitStatus.WaitOne();
|
||||
}
|
||||
}
|
||||
|
||||
Dispose();
|
||||
|
||||
Profile.FinishProfiling();
|
||||
device?.Dispose();
|
||||
DiscordIntegrationModule.Exit();
|
||||
Logger.Shutdown();
|
||||
Application.Quit();
|
||||
@@ -584,13 +595,11 @@ namespace Ryujinx.Ui
|
||||
|
||||
private void Exit_Pressed(object sender, EventArgs args)
|
||||
{
|
||||
_screen?.Exit();
|
||||
End(_emulationContext);
|
||||
}
|
||||
|
||||
private void Window_Close(object sender, DeleteEventArgs args)
|
||||
{
|
||||
_screen?.Exit();
|
||||
End(_emulationContext);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user