comparison transform/TransformFactory.cpp @ 600:3f6d9930bc28

* Fix crash on exit on win32. This was caused by incorrectly using fftw_free() to free the string returned from fftw_export_wisdom_to_string(), instead of plain free(). * Various debug artifacts related to tracking down the above
author Chris Cannam
date Fri, 14 Aug 2009 14:01:09 +0000
parents ecbd99d5d2c4
children b4a8d8221eaf
comparison
equal deleted inserted replaced
599:f3211e01b315 600:3f6d9930bc28
67 67
68 TransformFactory::~TransformFactory() 68 TransformFactory::~TransformFactory()
69 { 69 {
70 m_exiting = true; 70 m_exiting = true;
71 if (m_thread) { 71 if (m_thread) {
72 #ifdef DEBUG_TRANSFORM_FACTORY
72 std::cerr << "TransformFactory::~TransformFactory: waiting on thread" << std::endl; 73 std::cerr << "TransformFactory::~TransformFactory: waiting on thread" << std::endl;
74 #endif
73 m_thread->wait(); 75 m_thread->wait();
74 delete m_thread; 76 delete m_thread;
77 #ifdef DEBUG_TRANSFORM_FACTORY
78 std::cerr << "TransformFactory::~TransformFactory: waited and done" << std::endl;
79 #endif
75 } 80 }
76 } 81 }
77 82
78 void 83 void
79 TransformFactory::startPopulationThread() 84 TransformFactory::startPopulationThread()
105 populateTransforms(); 110 populateTransforms();
106 111
107 std::set<TransformDescription> dset; 112 std::set<TransformDescription> dset;
108 for (TransformDescriptionMap::const_iterator i = m_transforms.begin(); 113 for (TransformDescriptionMap::const_iterator i = m_transforms.begin();
109 i != m_transforms.end(); ++i) { 114 i != m_transforms.end(); ++i) {
110 // cerr << "inserting transform into set: id = " << i->second.identifier.toStdString() << endl; 115 #ifdef DEBUG_TRANSFORM_FACTORY
116 cerr << "inserting transform into set: id = " << i->second.identifier.toStdString() << endl;
117 #endif
111 dset.insert(i->second); 118 dset.insert(i->second);
112 } 119 }
113 120
114 TransformList list; 121 TransformList list;
115 for (std::set<TransformDescription>::const_iterator i = dset.begin(); 122 for (std::set<TransformDescription>::const_iterator i = dset.begin();
116 i != dset.end(); ++i) { 123 i != dset.end(); ++i) {
117 // cerr << "inserting transform into list: id = " << i->identifier.toStdString() << endl; 124 #ifdef DEBUG_TRANSFORM_FACTORY
125 cerr << "inserting transform into list: id = " << i->identifier.toStdString() << endl;
126 #endif
118 list.push_back(*i); 127 list.push_back(*i);
119 } 128 }
120 129
121 return list; 130 return list;
122 } 131 }
147 populateUninstalledTransforms(); 156 populateUninstalledTransforms();
148 157
149 std::set<TransformDescription> dset; 158 std::set<TransformDescription> dset;
150 for (TransformDescriptionMap::const_iterator i = m_uninstalledTransforms.begin(); 159 for (TransformDescriptionMap::const_iterator i = m_uninstalledTransforms.begin();
151 i != m_uninstalledTransforms.end(); ++i) { 160 i != m_uninstalledTransforms.end(); ++i) {
152 // cerr << "inserting transform into set: id = " << i->second.identifier.toStdString() << endl; 161 #ifdef DEBUG_TRANSFORM_FACTORY
162 cerr << "inserting transform into set: id = " << i->second.identifier.toStdString() << endl;
163 #endif
153 dset.insert(i->second); 164 dset.insert(i->second);
154 } 165 }
155 166
156 TransformList list; 167 TransformList list;
157 for (std::set<TransformDescription>::const_iterator i = dset.begin(); 168 for (std::set<TransformDescription>::const_iterator i = dset.begin();
158 i != dset.end(); ++i) { 169 i != dset.end(); ++i) {
159 // cerr << "inserting transform into uninstalled list: id = " << i->identifier.toStdString() << endl; 170 #ifdef DEBUG_TRANSFORM_FACTORY
171 cerr << "inserting transform into uninstalled list: id = " << i->identifier.toStdString() << endl;
172 #endif
160 list.push_back(*i); 173 list.push_back(*i);
161 } 174 }
162 175
163 return list; 176 return list;
164 } 177 }
462 } 475 }
463 476
464 bool configurable = (!plugin->getPrograms().empty() || 477 bool configurable = (!plugin->getPrograms().empty() ||
465 !plugin->getParameterDescriptors().empty()); 478 !plugin->getParameterDescriptors().empty());
466 479
467 // cerr << "Feature extraction plugin transform: " << transformId.toStdString() << " friendly name: " << friendlyName.toStdString() << endl; 480 #ifdef DEBUG_TRANSFORM_FACTORY
481 cerr << "Feature extraction plugin transform: " << transformId.toStdString() << " friendly name: " << friendlyName.toStdString() << endl;
482 #endif
468 483
469 transforms[transformId] = 484 transforms[transformId] =
470 TransformDescription(TransformDescription::Analysis, 485 TransformDescription(TransformDescription::Analysis,
471 category, 486 category,
472 transformId, 487 transformId,
640 for (QStringList::const_iterator i = ids.begin(); i != ids.end(); ++i) { 655 for (QStringList::const_iterator i = ids.begin(); i != ids.end(); ++i) {
641 656
642 PluginRDFDescription desc(*i); 657 PluginRDFDescription desc(*i);
643 658
644 QString name = desc.getPluginName(); 659 QString name = desc.getPluginName();
645 // if (name == "") { 660 #ifdef DEBUG_TRANSFORM_FACTORY
646 // std::cerr << "TransformFactory::populateUninstalledTransforms: " 661 if (name == "") {
647 // << "No name available for plugin " << i->toStdString() 662 std::cerr << "TransformFactory::populateUninstalledTransforms: "
648 // << ", skipping" << std::endl; 663 << "No name available for plugin " << i->toStdString()
649 // continue; 664 << ", skipping" << std::endl;
650 // } 665 continue;
666 }
667 #endif
651 668
652 QString description = desc.getPluginDescription(); 669 QString description = desc.getPluginDescription();
653 QString maker = desc.getPluginMaker(); 670 QString maker = desc.getPluginMaker();
654 QString infoUrl = desc.getPluginInfoURL(); 671 QString infoUrl = desc.getPluginInfoURL();
655 672
658 for (QStringList::const_iterator j = oids.begin(); j != oids.end(); ++j) { 675 for (QStringList::const_iterator j = oids.begin(); j != oids.end(); ++j) {
659 676
660 TransformId tid = Transform::getIdentifierForPluginOutput(*i, *j); 677 TransformId tid = Transform::getIdentifierForPluginOutput(*i, *j);
661 678
662 if (m_transforms.find(tid) != m_transforms.end()) { 679 if (m_transforms.find(tid) != m_transforms.end()) {
663 // std::cerr << "TransformFactory::populateUninstalledTransforms: " 680 #ifdef DEBUG_TRANSFORM_FACTORY
664 // << tid.toStdString() << " is installed; adding info url if appropriate, skipping rest" << std::endl; 681 std::cerr << "TransformFactory::populateUninstalledTransforms: "
682 << tid.toStdString() << " is installed; adding info url if appropriate, skipping rest" << std::endl;
683 #endif
665 if (infoUrl != "") { 684 if (infoUrl != "") {
666 if (m_transforms[tid].infoUrl == "") { 685 if (m_transforms[tid].infoUrl == "") {
667 m_transforms[tid].infoUrl = infoUrl; 686 m_transforms[tid].infoUrl = infoUrl;
668 } 687 }
669 } 688 }
670 continue; 689 continue;
671 } 690 }
672 691
673 // std::cerr << "TransformFactory::populateUninstalledTransforms: " 692 #ifdef DEBUG_TRANSFORM_FACTORY
674 // << "adding " << tid.toStdString() << std::endl; 693 std::cerr << "TransformFactory::populateUninstalledTransforms: "
694 << "adding " << tid.toStdString() << std::endl;
695 #endif
675 696
676 QString oname = desc.getOutputName(*j); 697 QString oname = desc.getOutputName(*j);
677 if (oname == "") oname = *j; 698 if (oname == "") oname = *j;
678 699
679 TransformDescription td; 700 TransformDescription td;
721 if (m_exiting) return; 742 if (m_exiting) return;
722 } 743 }
723 744
724 m_uninstalledTransformsPopulated = true; 745 m_uninstalledTransformsPopulated = true;
725 746
747 #ifdef DEBUG_TRANSFORM_FACTORY
726 std::cerr << "populateUninstalledTransforms exiting" << std::endl; 748 std::cerr << "populateUninstalledTransforms exiting" << std::endl;
749 #endif
727 } 750 }
728 751
729 Transform 752 Transform
730 TransformFactory::getDefaultTransformFor(TransformId id, size_t rate) 753 TransformFactory::getDefaultTransformFor(TransformId id, size_t rate)
731 { 754 {