App: fix Link extensionGetPropertyByName()
Do not query linked object if the owner object has property with the given name.
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include "Link.h"
|
||||
#include "LinkBaseExtensionPy.h"
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include "ComplexGeoData.h"
|
||||
#include "ComplexGeoDataPy.h"
|
||||
|
||||
@@ -1421,14 +1422,21 @@ static bool isExcludedProperties(const char *name) {
|
||||
}
|
||||
|
||||
Property *LinkBaseExtension::extensionGetPropertyByName(const char* name) const {
|
||||
auto prop = inherited::extensionGetPropertyByName(name);
|
||||
if(prop || isExcludedProperties(name))
|
||||
return prop;
|
||||
if (checkingProperty)
|
||||
return inherited::extensionGetPropertyByName(name);
|
||||
Base::StateLocker guard(checkingProperty);
|
||||
if(isExcludedProperties(name))
|
||||
return nullptr;
|
||||
auto owner = getContainer();
|
||||
if(owner && owner->canLinkProperties()) {
|
||||
auto linked = getTrueLinkedObject(true);
|
||||
if(linked)
|
||||
return linked->getPropertyByName(name);
|
||||
if (owner) {
|
||||
App::Property *prop = owner->getPropertyByName(name);
|
||||
if(prop)
|
||||
return prop;
|
||||
if(owner->canLinkProperties()) {
|
||||
auto linked = getTrueLinkedObject(true);
|
||||
if(linked)
|
||||
return linked->getPropertyByName(name);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -319,6 +319,8 @@ protected:
|
||||
mutable bool enableLabelCache;
|
||||
|
||||
bool hasOldSubElement;
|
||||
|
||||
mutable bool checkingProperty = false;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user