Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Commit

Permalink
CCApplication: GameExit deterministic disposal or graphics resources
Browse files Browse the repository at this point in the history
* proposed fix for #100
* we explicitly call graphDev.Dispose to ensure graphics resources are Disposed of before any finalisers are called
  • Loading branch information
rtabbara committed Jan 24, 2015
1 parent 60e6716 commit 874e765
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/platform/CCApplication.cs
Expand Up @@ -706,6 +706,10 @@ void GameDeactivated(object sender, EventArgs e)

void GameExiting(object sender, EventArgs e)
{
// Explicitly dispose of graphics device which will in turn dispose of all graphics resources
// This allows us to delete things in a deterministic manner without relying on finalizers
xnaGame.GraphicsDevice.Dispose();

foreach (CCWindow window in gameWindows)
{
window.EndAllSceneDirectors();
Expand Down
1 change: 0 additions & 1 deletion src/platform/CCDrawManager.cs
Expand Up @@ -1394,7 +1394,6 @@ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
ReinitResource();
isDisposed = true;
}
}
Expand Down

0 comments on commit 874e765

Please sign in to comment.