fix dangling pointer, remove superfluous semicolons, avoid excessive report messages of extension object
This commit is contained in:
parent
47dd79ac25
commit
956a21a81a
|
@ -105,7 +105,7 @@ PyObject* Extension::getExtensionPyObject(void) {
|
|||
return Py::new_reference_to(ExtensionPythonObject);
|
||||
}
|
||||
|
||||
const char* Extension::name() {
|
||||
std::string Extension::name() const {
|
||||
|
||||
if(m_extensionType.isBad())
|
||||
throw Base::Exception("Extension::setExtendedObject: Extension type not set");
|
||||
|
@ -114,9 +114,9 @@ const char* Extension::name() {
|
|||
std::string::size_type pos = temp.find_last_of(":");
|
||||
|
||||
if(pos != std::string::npos)
|
||||
return temp.substr(pos+1).c_str();
|
||||
return temp.substr(pos+1);
|
||||
else
|
||||
return std::string().c_str();
|
||||
return std::string();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -217,13 +217,13 @@ public:
|
|||
|
||||
void initExtension(App::ExtensionContainer* obj);
|
||||
|
||||
App::ExtensionContainer* getExtendedContainer() {return m_base;};
|
||||
const App::ExtensionContainer* getExtendedContainer() const {return m_base;};
|
||||
App::ExtensionContainer* getExtendedContainer() {return m_base;}
|
||||
const App::ExtensionContainer* getExtendedContainer() const {return m_base;}
|
||||
|
||||
//get extension name without namespace
|
||||
const char* name();
|
||||
std::string name() const;
|
||||
|
||||
bool isPythonExtension() {return m_isPythonExtension;};
|
||||
bool isPythonExtension() {return m_isPythonExtension;}
|
||||
|
||||
virtual PyObject* getExtensionPyObject(void);
|
||||
|
||||
|
@ -258,10 +258,10 @@ public:
|
|||
bool extensionIsDerivedFrom(const Base::Type type) const {return getExtensionTypeId().isDerivedFrom(type);}
|
||||
protected:
|
||||
static void initExtensionSubclass(Base::Type &toInit,const char* ClassName, const char *ParentName,
|
||||
Base::Type::instantiationMethod method=0);
|
||||
Base::Type::instantiationMethod method=0);
|
||||
//@}
|
||||
|
||||
virtual void extensionOnChanged(const Property* p) {(void)(p);};
|
||||
virtual void extensionOnChanged(const Property* p) {(void)(p);}
|
||||
|
||||
friend class App::ExtensionContainer;
|
||||
|
||||
|
@ -376,6 +376,6 @@ typedef ExtensionPythonT<App::Extension> ExtensionPython;
|
|||
return res.ptr();\
|
||||
};
|
||||
|
||||
}; //App
|
||||
} //App
|
||||
|
||||
#endif // APP_EXTENSION_H
|
||||
|
|
|
@ -87,7 +87,7 @@ bool ExtensionContainer::hasExtension(const char* name) const {
|
|||
|
||||
//and for types derived from it, as they can be cast to the extension
|
||||
for(auto entry : _extensions) {
|
||||
if(strcmp(entry.second->name(), name) == 0)
|
||||
if(strcmp(entry.second->name().c_str(), name) == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -114,7 +114,7 @@ Extension* ExtensionContainer::getExtension(const char* name) {
|
|||
|
||||
//and for types derived from it, as they can be cast to the extension
|
||||
for(auto entry : _extensions) {
|
||||
if(strcmp(entry.second->name(), name) == 0)
|
||||
if(strcmp(entry.second->name().c_str(), name) == 0)
|
||||
return entry.second;
|
||||
}
|
||||
return nullptr;
|
||||
|
|
|
@ -580,9 +580,13 @@ void ViewProvider::dragObject(App::DocumentObject* obj) {
|
|||
bool ViewProvider::canDropObject(App::DocumentObject* obj) const {
|
||||
|
||||
auto vector = getExtensionsDerivedFromType<Gui::ViewProviderExtension>();
|
||||
Base::Console().Message("Check extensions for drop\n");
|
||||
#if FC_DEBUG
|
||||
Base::Console().Log("Check extensions for drop\n");
|
||||
#endif
|
||||
for(Gui::ViewProviderExtension* ext : vector){
|
||||
Base::Console().Message("Check extensions %s\n", ext->name());
|
||||
#if FC_DEBUG
|
||||
Base::Console().Log("Check extensions %s\n", ext->name().c_str());
|
||||
#endif
|
||||
if(ext->extensionCanDropObject(obj))
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user