Fix minor memory leaks, by nathanm32292394 - #676
* delete star effect in kart destructor * clean up challenges in gameslot destructor * music information's normal and fast music git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11394 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -262,11 +262,13 @@ void MusicInformation::stopMusic()
|
||||
if (m_normal_music != NULL)
|
||||
{
|
||||
m_normal_music->stopMusic();
|
||||
delete m_normal_music;
|
||||
m_normal_music = NULL;
|
||||
}
|
||||
if (m_fast_music != NULL)
|
||||
{
|
||||
m_fast_music->stopMusic();
|
||||
delete m_fast_music;
|
||||
m_fast_music=NULL;
|
||||
}
|
||||
} // stopMusic
|
||||
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
ChallengeData* m_data;
|
||||
|
||||
public:
|
||||
Challenge(ChallengeData* data)
|
||||
Challenge(ChallengeData* data)
|
||||
{
|
||||
m_data = data;
|
||||
m_state[RaceManager::RD_EASY] = CH_INACTIVE;
|
||||
|
||||
@@ -19,12 +19,21 @@
|
||||
|
||||
#include "challenges/game_slot.hpp"
|
||||
|
||||
#include "challenges/challenge.hpp"
|
||||
#include "challenges/challenge_data.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "io/xml_writer.hpp"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
GameSlot::~GameSlot()
|
||||
{
|
||||
std::map<std::string, Challenge*>::iterator it;
|
||||
for (it = m_challenges_state.begin();it != m_challenges_state.end();it++)
|
||||
{
|
||||
delete it->second;
|
||||
}
|
||||
} // ~GameSlot
|
||||
//-----------------------------------------------------------------------------
|
||||
bool GameSlot::isLocked(const std::string& feature)
|
||||
{
|
||||
return m_locked_features.find(feature)!=m_locked_features.end();
|
||||
|
||||
@@ -42,8 +42,9 @@ class GameSlot
|
||||
{
|
||||
std::string m_kart_ident;
|
||||
|
||||
/** Profile names can change, so rather than try to make sure all renames are done everywhere,
|
||||
* assign a unique ID to each profiler. Will save much headaches.
|
||||
/** Profile names can change, so rather than try to make sure all renames
|
||||
* are done everywhere, assign a unique ID to each profiler.
|
||||
* Will save much headaches.
|
||||
*/
|
||||
std::string m_player_unique_id;
|
||||
|
||||
@@ -82,6 +83,7 @@ public:
|
||||
m_medium_challenges = 0;
|
||||
m_hard_challenges = 0;
|
||||
}
|
||||
~GameSlot();
|
||||
|
||||
const std::string& getPlayerID() const { return m_player_unique_id; }
|
||||
const std::string& getKartIdent () const { return m_kart_ident; }
|
||||
|
||||
@@ -109,6 +109,7 @@ Kart::Kart (const std::string& ident, unsigned int world_kart_id,
|
||||
m_flying = false;
|
||||
m_rain = NULL;
|
||||
m_sky_particles_emitter= NULL;
|
||||
m_stars_effect = NULL;
|
||||
|
||||
m_view_blocked_by_plunger = 0;
|
||||
|
||||
@@ -232,6 +233,7 @@ Kart::~Kart()
|
||||
if(m_rain) delete m_rain;
|
||||
if(m_sky_particles_emitter) delete m_sky_particles_emitter;
|
||||
if(m_attachment) delete m_attachment;
|
||||
if (m_stars_effect) delete m_stars_effect;
|
||||
|
||||
delete m_shadow;
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ void KartPropertiesManager::reLoadAllKarts()
|
||||
m_kart_available.clear();
|
||||
m_groups_2_indices.clear();
|
||||
m_all_groups.clear();
|
||||
loadAllKarts(false);
|
||||
loadAllKarts(false);
|
||||
} // reLoadAllKarts
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -144,7 +144,7 @@ void KartPropertiesManager::removeKart(const std::string &ident)
|
||||
|
||||
delete kp;
|
||||
|
||||
// Only used for networking only, and it is safe to just clear it.
|
||||
// Only used for networking and it is safe to just clear it.
|
||||
// If a networking game is started it will be initialised properly.
|
||||
m_selected_karts.clear();
|
||||
} // removeKart
|
||||
@@ -235,7 +235,6 @@ bool KartPropertiesManager::loadKart(const std::string &dir)
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Returns index of the kart properties with the given ident.
|
||||
* \return Index of kart (between 0 and number of karts - 1).
|
||||
|
||||
*/
|
||||
const int KartPropertiesManager::getKartId(const std::string &ident) const
|
||||
{
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
bool loadKart (const std::string &dir);
|
||||
void loadAllKarts (bool loading_icon = true);
|
||||
void unloadAllKarts ();
|
||||
void reLoadAllKarts ();
|
||||
void reLoadAllKarts ();
|
||||
void removeKart(const std::string &id);
|
||||
const std::vector<int> getKartsInGroup (const std::string& g);
|
||||
bool kartAvailable(int kartid);
|
||||
|
||||
Reference in New Issue
Block a user