Mercurial > hg > tony
comparison src/Analyser.cpp @ 226:9bdff8d10a86
Fix #899 crash when loading new file
author | Chris Cannam |
---|---|
date | Mon, 10 Mar 2014 14:59:50 +0000 |
parents | d323b5d41570 |
children | ae0bf8dc5833 |
comparison
equal
deleted
inserted
replaced
225:dd97a58277ea | 226:9bdff8d10a86 |
---|---|
104 emit layersChanged(); | 104 emit layersChanged(); |
105 | 105 |
106 return warning; | 106 return warning; |
107 } | 107 } |
108 | 108 |
109 void | |
110 Analyser::fileClosed() | |
111 { | |
112 cerr << "Analyser::fileClosed" << endl; | |
113 m_layers.clear(); | |
114 m_reAnalysisCandidates.clear(); | |
115 m_currentCandidate = -1; | |
116 m_reAnalysingSelection = Selection(); | |
117 } | |
118 | |
109 QString | 119 QString |
110 Analyser::addVisualisations() | 120 Analyser::addVisualisations() |
111 { | 121 { |
112 /* | 122 /* |
113 TransformFactory *tf = TransformFactory::getInstance(); | 123 TransformFactory *tf = TransformFactory::getInstance(); |
356 Analyser::layersCreated(vector<Layer *> primary, | 366 Analyser::layersCreated(vector<Layer *> primary, |
357 vector<Layer *> additional) | 367 vector<Layer *> additional) |
358 { | 368 { |
359 //!!! how do we know these came from the right selection? user | 369 //!!! how do we know these came from the right selection? user |
360 //!!! might have made another one since this request was issued | 370 //!!! might have made another one since this request was issued |
371 | |
372 if (m_reAnalysingSelection == Selection()) { | |
373 // We don't want these (actually, as above, this should check | |
374 // that the selection is the same as the one requested -- but | |
375 // all we're doing here is checking that the selection exists | |
376 // at all, so hasn't been cleared or the document deleted or | |
377 // whatever) | |
378 for (int i = 0; i < (int)primary.size(); ++i) { | |
379 m_document->deleteLayer(primary[i]); | |
380 } | |
381 for (int i = 0; i < (int)additional.size(); ++i) { | |
382 m_document->deleteLayer(additional[i]); | |
383 } | |
384 return; | |
385 } | |
361 | 386 |
362 CommandHistory::getInstance()->startCompoundOperation | 387 CommandHistory::getInstance()->startCompoundOperation |
363 (tr("Re-Analyse Selection"), true); | 388 (tr("Re-Analyse Selection"), true); |
364 | 389 |
365 vector<Layer *> all; | 390 vector<Layer *> all; |