Fixed debug build crash on mac, reading from stringstream into emtpy string crashed when compiling with clang

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@579 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Jan Möbius
2012-05-02 12:34:42 +00:00
parent 7cfc461f66
commit c656256933

View File

@@ -69,7 +69,10 @@ _IOManager_ *__IOManager_instance = 0;
_IOManager_& IOManager()
{
if (!__IOManager_instance) __IOManager_instance = new _IOManager_();
if (!__IOManager_instance)
__IOManager_instance = new _IOManager_();
return *__IOManager_instance;
}
@@ -260,21 +263,29 @@ update_read_filters()
{
std::set<BaseReader*>::const_iterator it = reader_modules_.begin(),
it_end = reader_modules_.end();
std::string s, all, filters;
std::string all = "";
std::string filters = "";
for(; it != it_end; ++it)
{
// Initialized with space, as a workaround for debug build with clang on mac
// which crashes if tmp is initialized with an empty string ?!
std::string tmp = " ";
filters += (*it)->get_description() + " (";
std::istringstream iss((*it)->get_extensions());
while (iss && !iss.eof() && (iss >> s))
{ s = " *." + s; filters += s; all += s; }
while (iss && !iss.eof() && (iss >> tmp) )
{
tmp = " *." + tmp; filters += tmp; all += tmp;
}
filters += " );;";
}
all = "All files ( " + all + " );;";
read_filters_ = all + filters;
}
@@ -288,10 +299,15 @@ update_write_filters()
{
std::set<BaseWriter*>::const_iterator it = writer_modules_.begin(),
it_end = writer_modules_.end();
std::string s, all, filters;
std::string all;
std::string filters;
for(; it != it_end; ++it)
{
// Initialized with space, as a workaround for debug build with clang on mac
// which crashes if tmp is initialized with an empty string ?!
std::string s = " ";
filters += (*it)->get_description() + " (";
std::istringstream iss((*it)->get_extensions());