Changeset 2230 for trunk/src


Ignore:
Timestamp:
Jan 17, 2013, 11:19:30 PM (8 years ago)
Author:
sam
Message:

base: fix a nasty double free issue in Array::Remove().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lol/base/array.h

    r2216 r2230  
    164164    void Remove(int pos, int todelete = 1)
    165165    {
    166         /* FIXME: we need to call dtors for the first
    167          * todelete elements here */
    168166        for (int i = pos; i + todelete < m_count; i++)
    169167            m_data[i] = m_data[i + todelete];
     
    183181        /* Not enough elements? Add some. */
    184182        for (int i = m_count; i < count; ++i)
    185             m_data[i] = e;
     183            new(&m_data[i]) Element(e);
    186184
    187185        m_count = count;
Note: See TracChangeset for help on using the changeset viewer.