Compositor: Fix memory leaks when initializing tiles multi-threaded
It was only affecting tiled fallback on full frame mode. If tiles from a constant operation were multi-thread initialized, its buffer was inflated multiple times.
This commit is contained in:
parent
1a9b9dd64d
commit
b81d88a8e2
|
@ -41,20 +41,32 @@ const float *BufferOperation::get_constant_elem()
|
|||
return buffer_->getBuffer();
|
||||
}
|
||||
|
||||
void BufferOperation::initExecution()
|
||||
{
|
||||
if (buffer_->is_a_single_elem()) {
|
||||
initMutex();
|
||||
}
|
||||
}
|
||||
|
||||
void *BufferOperation::initializeTileData(rcti * /*rect*/)
|
||||
{
|
||||
if (buffer_->is_a_single_elem() == false) {
|
||||
return buffer_;
|
||||
}
|
||||
|
||||
lockMutex();
|
||||
if (!inflated_buffer_) {
|
||||
inflated_buffer_ = buffer_->inflate();
|
||||
}
|
||||
unlockMutex();
|
||||
return inflated_buffer_;
|
||||
}
|
||||
|
||||
void BufferOperation::deinitExecution()
|
||||
{
|
||||
if (buffer_->is_a_single_elem()) {
|
||||
deinitMutex();
|
||||
}
|
||||
delete inflated_buffer_;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ class BufferOperation : public ConstantOperation {
|
|||
|
||||
const float *get_constant_elem() override;
|
||||
void *initializeTileData(rcti *rect) override;
|
||||
void initExecution() override;
|
||||
void deinitExecution() override;
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
void executePixelFiltered(float output[4], float x, float y, float dx[2], float dy[2]) override;
|
||||
|
|
Loading…
Reference in New Issue