Mercurial > hg > svapp
comparison framework/Document.cpp @ 79:b1a68403714b
* Further model lifecycle fixes
author | Chris Cannam |
---|---|
date | Thu, 24 Jan 2008 11:03:59 +0000 |
parents | 58bfaaed07ed |
children | 0948bf800422 |
comparison
equal
deleted
inserted
replaced
78:58bfaaed07ed | 79:b1a68403714b |
---|---|
77 if (model == m_mainModel) { | 77 if (model == m_mainModel) { |
78 // just in case! | 78 // just in case! |
79 std::cerr << "Document::~Document: WARNING: Main model is also" | 79 std::cerr << "Document::~Document: WARNING: Main model is also" |
80 << " in models list!" << std::endl; | 80 << " in models list!" << std::endl; |
81 } else if (model) { | 81 } else if (model) { |
82 model->aboutToDelete(); | |
82 emit modelAboutToBeDeleted(model); | 83 emit modelAboutToBeDeleted(model); |
83 model->aboutToDelete(); | |
84 delete model; | 84 delete model; |
85 } | 85 } |
86 m_models.erase(m_models.begin()); | 86 m_models.erase(m_models.begin()); |
87 } | 87 } |
88 } | 88 } |
90 #ifdef DEBUG_DOCUMENT | 90 #ifdef DEBUG_DOCUMENT |
91 std::cerr << "Document::~Document: About to get rid of main model" | 91 std::cerr << "Document::~Document: About to get rid of main model" |
92 << std::endl; | 92 << std::endl; |
93 #endif | 93 #endif |
94 if (m_mainModel) { | 94 if (m_mainModel) { |
95 m_mainModel->aboutToDelete(); | |
95 emit modelAboutToBeDeleted(m_mainModel); | 96 emit modelAboutToBeDeleted(m_mainModel); |
96 m_mainModel->aboutToDelete(); | |
97 } | 97 } |
98 | 98 |
99 emit mainModelChanged(0); | 99 emit mainModelChanged(0); |
100 delete m_mainModel; | 100 delete m_mainModel; |
101 | 101 |
375 alignModel(i->first); | 375 alignModel(i->first); |
376 } | 376 } |
377 } | 377 } |
378 | 378 |
379 if (oldMainModel) { | 379 if (oldMainModel) { |
380 oldMainModel->aboutToDelete(); | |
380 emit modelAboutToBeDeleted(oldMainModel); | 381 emit modelAboutToBeDeleted(oldMainModel); |
381 oldMainModel->aboutToDelete(); | |
382 } | 382 } |
383 | 383 |
384 emit mainModelChanged(m_mainModel); | 384 emit mainModelChanged(m_mainModel); |
385 | 385 |
386 delete oldMainModel; | 386 delete oldMainModel; |
507 << model << " even though it is source for " | 507 << model << " even though it is source for " |
508 << sourceCount << " other derived model(s) -- resetting " | 508 << sourceCount << " other derived model(s) -- resetting " |
509 << "their source fields appropriately" << std::endl; | 509 << "their source fields appropriately" << std::endl; |
510 } | 510 } |
511 | 511 |
512 model->aboutToDelete(); | |
512 emit modelAboutToBeDeleted(model); | 513 emit modelAboutToBeDeleted(model); |
513 model->aboutToDelete(); | |
514 m_models.erase(model); | 514 m_models.erase(model); |
515 delete model; | 515 delete model; |
516 } | 516 } |
517 } | 517 } |
518 | 518 |