From 37cff8a09ea86388334827513b854f1711f6b5eb Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 11 Dec 2004 08:35:23 +0000 Subject: [PATCH] don't unload resources shared between backgrounds when loading a new background --- stepmania/src/ScreenManager.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index d7a4cda70b..172d0303f5 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -341,7 +341,13 @@ retry: CString sNewBGA = THEME->GetPathToB(sScreenName+" background"); if( m_sLastLoadedBackground != sNewBGA ) { - m_pSharedBGA->LoadFromAniDir( sNewBGA ); + // Create the new background before deleting the previous so that we keep + // any common textures loaded. + BGAnimation *pNewBGA = new BGAnimation; + pNewBGA->LoadFromAniDir( sNewBGA ); + SAFE_DELETE( m_pSharedBGA ); + m_pSharedBGA = pNewBGA; + m_sLastLoadedBackground = sNewBGA; }