void Problem::clearProblems( HasProblems& p, bool setchanged, bool includeInvalidData ) { // Nothing to do if (!p.firstProblem) return; // Delete all problems in the list Problem *keepfirst = nullptr; for (Problem *cur=p.firstProblem; cur; ) { Problem *del = cur; cur = cur->nextProblem; if (includeInvalidData || typeid(*del) != typeid(ProblemInvalidData)) { del->owner = nullptr; delete del; } else if (!keepfirst) { keepfirst = del; if (keepfirst) keepfirst->nextProblem = del; del->nextProblem = NULL; } } p.firstProblem = keepfirst; // Mark as changed if (setchanged) p.getEntity()->setChanged(); }
DECLARE_EXPORT void Problem::clearProblems(HasProblems& p, bool setchanged) { // Nothing to do if (!p.firstProblem) return; // Delete all problems in the list for (Problem *cur=p.firstProblem; cur; ) { Problem *del = cur; cur = cur->nextProblem; del->owner = NULL; delete del; } p.firstProblem = NULL; // Mark as changed if (setchanged) p.getEntity()->setChanged(); }