comparison data/model/Model.cpp @ 1384:368449629a30

Fix various "model deleted with no aboutToDelete notification" warnings (and one associated potential memory leak)
author Chris Cannam
date Wed, 22 Feb 2017 12:01:39 +0000
parents cc27f35aa75c
children 48e9f538e6e9
comparison
equal deleted inserted replaced
1383:f204f2fcb15e 1384:368449629a30
25 Model::~Model() 25 Model::~Model()
26 { 26 {
27 // SVDEBUG << "Model::~Model(" << this << ")" << endl; 27 // SVDEBUG << "Model::~Model(" << this << ")" << endl;
28 28
29 if (!m_aboutToDelete) { 29 if (!m_aboutToDelete) {
30 SVDEBUG << "NOTE: Model::~Model(" << this << ", \"" 30 SVDEBUG << "NOTE: Model(" << this << ", \""
31 << objectName() << "\"): Model deleted " 31 << objectName() << "\", type uri <"
32 << "with no aboutToDelete notification" << endl; 32 << m_typeUri << ">)::~Model(): Model deleted "
33 << "with no aboutToDelete notification"
34 << endl;
33 } 35 }
34 36
35 if (m_alignment) { 37 if (m_alignment) {
36 m_alignment->aboutToDelete(); 38 m_alignment->aboutToDelete();
37 delete m_alignment; 39 delete m_alignment;
57 } 59 }
58 60
59 void 61 void
60 Model::aboutToDelete() 62 Model::aboutToDelete()
61 { 63 {
62 // cerr << "Model(" << this << ")::aboutToDelete()" << endl; 64 // SVDEBUG << "Model(" << this << ", \""
65 // << objectName() << "\", type uri <"
66 // << m_typeUri << ">)::aboutToDelete()" << endl;
63 67
64 if (m_aboutToDelete) { 68 if (m_aboutToDelete) {
65 cerr << "WARNING: Model(" << this << ", \"" 69 SVDEBUG << "WARNING: Model(" << this << ", \""
66 << objectName() << "\")::aboutToDelete: " 70 << objectName() << "\", type uri <"
67 << "aboutToDelete called more than once for the same model" 71 << m_typeUri << ">)::aboutToDelete: "
68 << endl; 72 << "aboutToDelete called more than once for the same model"
73 << endl;
69 } 74 }
70 75
71 emit aboutToBeDeleted(); 76 emit aboutToBeDeleted();
72 m_aboutToDelete = true; 77 m_aboutToDelete = true;
73 } 78 }