This ensures we don't segfault if the pending lemma vector is cleared while we are processing it. This is potentially possible in datatypes currently. Fixes #5236.
return;
}
d_processingPendingLemmas = true;
- for (const std::unique_ptr<TheoryInference>& plem : d_pendingLem)
+ size_t i = 0;
+ while (i < d_pendingLem.size())
{
- // process this lemma
- plem->process(this, true);
+ // process this lemma, which notice may enqueue more pending lemmas in this
+ // loop, or clear the lemmas.
+ d_pendingLem[i]->process(this, true);
+ i++;
}
d_pendingLem.clear();
d_processingPendingLemmas = false;