Browse Source

image: fix two small but nasty bugs in the Image methods.

undefined
Sam Hocevar 10 years ago
parent
commit
60a8a64c8f
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      src/image/image.cpp

+ 2
- 1
src/image/image.cpp View File

@@ -117,13 +117,14 @@ Image & Image::operator =(Image other)
/* Since the argument is passed by value, we’re assured it’s a new /* Since the argument is passed by value, we’re assured it’s a new
* object and we can safely swap our m_data pointers. */ * object and we can safely swap our m_data pointers. */
std::swap(m_data, other.m_data); std::swap(m_data, other.m_data);
return *this;
} }


Image::~Image() Image::~Image()
{ {
for (int k : m_data->m_pixels.Keys()) for (int k : m_data->m_pixels.Keys())
{ {
delete m_data->m_pixels[k]; delete[] m_data->m_pixels[k];
m_data->m_pixels[k] = nullptr; m_data->m_pixels[k] = nullptr;
} }
delete m_data; delete m_data;


||||||
x
 
000:0
Loading…
Cancel
Save