diff --git a/Ryujinx.Profiler/UI/ProfileWindow.cs b/Ryujinx.Profiler/UI/ProfileWindow.cs
index ec65d5f450..1302158c02 100644
--- a/Ryujinx.Profiler/UI/ProfileWindow.cs
+++ b/Ryujinx.Profiler/UI/ProfileWindow.cs
@@ -209,6 +209,12 @@ namespace Ryujinx.Profiler.UI
/// There is no need to call the base implementation.
public void Update(FrameEventArgs e)
{
+ if (_visibleChanged)
+ {
+ Visible = _visible;
+ _visibleChanged = false;
+ }
+
// Backspace handling
if (_backspaceDown)
{
@@ -322,12 +328,6 @@ namespace Ryujinx.Profiler.UI
/// There is no need to call the base implementation.
public void Draw()
{
- if (_visibleChanged)
- {
- Visible = _visible;
- _visibleChanged = false;
- }
-
if (!_visible || !_initComplete)
{
return;
diff --git a/Ryujinx.Profiler/UI/ProfileWindowManager.cs b/Ryujinx.Profiler/UI/ProfileWindowManager.cs
index e20c64b196..da6b94253a 100644
--- a/Ryujinx.Profiler/UI/ProfileWindowManager.cs
+++ b/Ryujinx.Profiler/UI/ProfileWindowManager.cs
@@ -43,8 +43,6 @@ namespace Ryujinx.Profiler.UI
_window.Dispose();
}
- _profileThread.Join();
-
_window = null;
}
diff --git a/Ryujinx/Ui/GLScreen.cs b/Ryujinx/Ui/GLScreen.cs
index 4cbbaf9a30..0f89fa9fa5 100644
--- a/Ryujinx/Ui/GLScreen.cs
+++ b/Ryujinx/Ui/GLScreen.cs
@@ -287,6 +287,10 @@ namespace Ryujinx
protected override void OnUnload(EventArgs e)
{
+ #if USE_PROFILING
+ _profileWindow.Close();
+ #endif
+
_renderThread.Join();
base.OnUnload(e);