Skip to content

Commit

Permalink
Don't use std_vector for static vectors.
Browse files Browse the repository at this point in the history
Some implementations of std::vector do dumb stuff and the default constructor
actually allocates memory.  (Uggggggg.)  This causes problems if an app wants
to set a custom memory allocator, because by the time they do that these
vectors will have already allocated memory, and then if that memory needs to be
reallocated, by the custom allocator, we run into problems.

This fixes #209

P4:7032464
  • Loading branch information
zpostfacto committed Jan 27, 2022
1 parent 7b1fbfb commit b99aa75
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ CSteamNetworkConnectionBase::~CSteamNetworkConnectionBase()
}
}

static std_vector<CSteamNetworkConnectionBase *> s_vecPendingDeleteConnections;
static std::vector<CSteamNetworkConnectionBase *> s_vecPendingDeleteConnections;
static ShortDurationLock s_lockPendingDeleteConnections( "connection_delete_queue" );

void CSteamNetworkConnectionBase::ConnectionQueueDestroy()
Expand Down Expand Up @@ -661,7 +661,7 @@ void CSteamNetworkConnectionBase::ProcessDeletionList()
// want us to take a ShortDurationLock and then take any
// other locks.
s_lockPendingDeleteConnections.lock();
std_vector<CSteamNetworkConnectionBase *> vecTemp( std::move( s_vecPendingDeleteConnections ) );
std::vector<CSteamNetworkConnectionBase *> vecTemp( std::move( s_vecPendingDeleteConnections ) );
s_vecPendingDeleteConnections.clear();
s_lockPendingDeleteConnections.unlock();

Expand Down

0 comments on commit b99aa75

Please sign in to comment.