comparison data/model/AlignmentModel.cpp @ 1688:901f37d32060

Model deletion issues - the AlignmentModel doesn't actually need to know about the input aggregate model; the document should own it instead
author Chris Cannam
date Thu, 04 Apr 2019 11:15:43 +0100
parents 70e172e6cc59
children d08b560102a1
comparison
equal deleted inserted replaced
1608:0e0947896fd3 1688:901f37d32060
19 19
20 //#define DEBUG_ALIGNMENT_MODEL 1 20 //#define DEBUG_ALIGNMENT_MODEL 1
21 21
22 AlignmentModel::AlignmentModel(Model *reference, 22 AlignmentModel::AlignmentModel(Model *reference,
23 Model *aligned, 23 Model *aligned,
24 Model *inputModel,
25 SparseTimeValueModel *path) : 24 SparseTimeValueModel *path) :
26 m_reference(reference), 25 m_reference(reference),
27 m_aligned(aligned), 26 m_aligned(aligned),
28 m_inputModel(inputModel),
29 m_rawPath(path), 27 m_rawPath(path),
30 m_path(nullptr), 28 m_path(nullptr),
31 m_reversePath(nullptr), 29 m_reversePath(nullptr),
32 m_pathBegun(false), 30 m_pathBegun(false),
33 m_pathComplete(false) 31 m_pathComplete(false)
52 } 50 }
53 } 51 }
54 52
55 AlignmentModel::~AlignmentModel() 53 AlignmentModel::~AlignmentModel()
56 { 54 {
57 if (m_inputModel) m_inputModel->aboutToDelete();
58 delete m_inputModel;
59
60 if (m_rawPath) m_rawPath->aboutToDelete(); 55 if (m_rawPath) m_rawPath->aboutToDelete();
61 delete m_rawPath; 56 delete m_rawPath;
62 57
63 if (m_path) m_path->aboutToDelete(); 58 if (m_path) m_path->aboutToDelete();
64 delete m_path; 59 delete m_path;
210 if (m_pathComplete) { 205 if (m_pathComplete) {
211 206
212 constructPath(); 207 constructPath();
213 constructReversePath(); 208 constructReversePath();
214 209
215 if (m_inputModel) m_inputModel->aboutToDelete();
216 delete m_inputModel;
217 m_inputModel = nullptr;
218 } 210 }
219 } 211 }
220 212
221 emit completionChanged(); 213 emit completionChanged();
222 } 214 }