From 7b70f2835ce77ba44965ed7c20652a80c1ae5d96 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Wed, 27 Nov 2013 00:51:49 -0600 Subject: [PATCH] Ensure a unique FootprintEnumerate() return list in GITHUB_PLUGIN when using COW. --- pcbnew/github/github_plugin.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/pcbnew/github/github_plugin.cpp b/pcbnew/github/github_plugin.cpp index 14f3e21f9e..8b2d31ca92 100644 --- a/pcbnew/github/github_plugin.cpp +++ b/pcbnew/github/github_plugin.cpp @@ -42,6 +42,7 @@ #include #include +#include #include #include @@ -114,14 +115,28 @@ wxArrayString GITHUB_PLUGIN::FootprintEnumerate( //D(printf("%s: this:%p aLibraryPath:'%s'\n", __func__, this, TO_UTF8(aLibraryPath) );) cacheLib( aLibraryPath, aProperties ); - wxArrayString ret; + typedef std::set MYSET; + + MYSET unique; if( m_pretty_dir.size() ) - ret = PCB_IO::FootprintEnumerate( m_pretty_dir ); + { + wxArrayString locals = PCB_IO::FootprintEnumerate( m_pretty_dir ); + + for( unsigned i=0; ibegin(); it!=m_gh_cache->end(); ++it ) { - ret.Add( FROM_UTF8( it->first.c_str() ) ); + unique.insert( FROM_UTF8( it->first.c_str() ) ); + } + + wxArrayString ret; + + for( MYSET::const_iterator it = unique.begin(); it != unique.end(); ++it ) + { + ret.Add( *it ); } return ret;