I pass an Image object to my hash table with the method insert().
htImages.insert(WALL_UP_CLOSE, imgWalls[WALL_UP_CLOSE]);
As you can see, I'm passing the object into Value by reference.
void insert(const Key &key, const Value &value)
{
    Entry entry;
    int index;
    // Build up entry structure
    entry.m_key = key;
    entry.m_value = value;
    // Build the insertion index
    index = m_hash(key) % m_size;
    // Insert the value
    m_table[index].append(entry);
    m_count++;
}
However, once this function ends at the last line, the destructor below is being called.
Image::~Image()
{
    glDeleteTextures(1, &m_handle);
    refCount--;
}
My preference is that the destructor is not called. I'm passing it by reference, so why is the destructor being called?
 
    