Memory management in friends fetching back ok. Something weird happened with my commit this morning.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13488 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
unitraxx 2013-08-16 01:19:12 +00:00
parent c8df03e7ce
commit 10600e94f9
2 changed files with 4 additions and 12 deletions

View File

@ -46,8 +46,6 @@ namespace Online{
m_is_current_user = (m_id == CurrentUser::get()->getUserID());
m_has_fetched_friends = false;
m_friends_list_request = NULL;
}
// ============================================================================
@ -57,7 +55,7 @@ namespace Online{
if(m_has_fetched_friends)
return;
setState (S_FETCHING);
m_friends_list_request = requestFriendsList();
requestFriendsList();
}
// ============================================================================
@ -75,15 +73,13 @@ namespace Online{
m_friends.push_back(new User(username, friendid));
}
m_has_fetched_friends = true;
delete m_friends_list_request;
m_friends_list_request = NULL;
Profile::setState (Profile::S_READY);
}
// ============================================================================
const Profile::FriendsListRequest * Profile::requestFriendsList()
void Profile::requestFriendsList()
{
FriendsListRequest * request = new FriendsListRequest();
request->setURL((std::string)UserConfigParams::m_server_multiplayer + "client-user.php");
@ -92,7 +88,6 @@ namespace Online{
request->setParameter("userid", CurrentUser::get()->getUserID());
request->setParameter("visitingid", m_id);
HTTPManager::get()->addRequest(request);
return request;
}
void Profile::FriendsListRequest::callback()

View File

@ -45,7 +45,7 @@ namespace Online{
{
virtual void callback ();
public:
FriendsListRequest() : XMLRequest() {}
FriendsListRequest() : XMLRequest(0, true) {}
};
private:
@ -62,16 +62,13 @@ namespace Online{
bool m_has_fetched_friends;
PtrVector<Online::User> m_friends;
const FriendsListRequest * m_friends_list_request;
bool m_cache_bit;
void setState(State state) { m_state.setAtomic(state); }
const State getState() const { return m_state.getAtomic(); }
const FriendsListRequest * requestFriendsList();
void requestFriendsList();
void friendsListCallback(const XMLNode * input);
public: