Fix: Compositor retains old images

The compositor does not correctly free, wrap, or allocate images. That's
because the resetting mechanism didn't reset all members. This patch
rests all members and only retains the important ones.
This commit is contained in:
Omar Emara 2024-03-26 12:32:36 +02:00
parent a02b429324
commit df9b3d35a2
2 changed files with 8 additions and 7 deletions

View File

@ -275,11 +275,10 @@ class Result {
void set_initial_reference_count(int count);
/* Reset the result to prepare it for a new evaluation. This should be called before evaluating
* the operation that computes this result. First, set the value of reference_count_ to the value
* of initial_reference_count_ since reference_count_ may have already been decremented to zero
* in a previous evaluation. Second, set master_ to nullptr because the result may have been
* turned into a proxy result in a previous evaluation. Other fields don't need to be reset
* because they are runtime and overwritten during evaluation. */
* the operation that computes this result. Keep the type, precision, texture pool, and initial
* reference count, and rest all other members to their default value. Finally, set the value of
* reference_count_ to the value of initial_reference_count_ since reference_count_ may have
* already been decremented to zero in a previous evaluation. */
void reset();
/* Increment the reference count of the result by the given count. If this result have a master

View File

@ -389,8 +389,10 @@ void Result::set_initial_reference_count(int count)
void Result::reset()
{
master_ = nullptr;
reference_count_ = initial_reference_count_;
const int initial_reference_count = initial_reference_count_;
*this = Result(type_, *texture_pool_, precision_);
initial_reference_count_ = initial_reference_count;
reference_count_ = initial_reference_count;
}
void Result::increment_reference_count(int count)