Fixed a memory corruption issue, where AddImage was being called multiple times (at the same time). Added a lock, and I can no longer reproduce the crash.

This commit is contained in:
Jonathan Thomas
2016-03-08 00:38:06 -06:00
parent 4439131a82
commit ac774b4e3b
2 changed files with 2 additions and 0 deletions

View File

@@ -676,6 +676,7 @@ void Frame::AddColor(int width, int height, string color)
void Frame::AddImage(int width, int height, int bytes_per_pixel, QImage::Format type, const unsigned char *pixels_)
{
// Create new buffer
const GenericScopedLock<CriticalSection> lock(addingImageSection);
int buffer_size = width * height * bytes_per_pixel;
qbuffer = new unsigned char[buffer_size]();