Does not rely on the pointervalue returned by getNameInDocument() to use as a DAG key.
In order to make getNameInDocument() always return a valid string, we implement a getDagKey() method that shall be used instead of getNameInDocument() when we want to use the pointer value as a "key" to identify the DocumentObject.
This commit is contained in:
committed by
Chris Hennes
parent
c6911695e7
commit
0cbc9cd66e
@@ -292,6 +292,15 @@ std::string DocumentObject::getFullLabel() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
const char* DocumentObject::getDagKey() const
|
||||
{
|
||||
if(!pcNameInDocument)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return pcNameInDocument->c_str();
|
||||
}
|
||||
|
||||
const char *DocumentObject::getNameInDocument() const
|
||||
{
|
||||
// Note: It can happen that we query the internal name of an object even if it is not
|
||||
@@ -808,7 +817,7 @@ DocumentObject *DocumentObject::getSubObject(const char *subname,
|
||||
if(outList.size()!=_outListMap.size()) {
|
||||
_outListMap.clear();
|
||||
for(auto obj : outList)
|
||||
_outListMap[obj->getNameInDocument()] = obj;
|
||||
_outListMap[obj->getDagKey()] = obj;
|
||||
}
|
||||
auto it = _outListMap.find(name.c_str());
|
||||
if(it != _outListMap.end())
|
||||
|
||||
Reference in New Issue
Block a user