Skip to content
Permalink
Browse files

fixes #0003424: 'basic_string::_M_construct null not valid' when open…

…ing a v0.16 project with v0.17
  • Loading branch information...
wwmayer committed Apr 10, 2018
1 parent 0258808 commit aa0f6b54d497eb810cc2774fa01ac0bb0408541a
Showing with 30 additions and 18 deletions.
  1. +20 −12 src/App/FeaturePython.cpp
  2. +10 −6 src/Gui/ViewProviderPythonFeature.cpp
@@ -108,17 +108,21 @@ void FeaturePythonImp::onBeforeChange(const Property* prop)
if (feature.hasAttr("__object__")) {
Py::Callable method(feature.getAttr(std::string("onBeforeChange")));
Py::Tuple args(1);
std::string prop_name = object->getPropertyName(prop);
args.setItem(0, Py::String(prop_name));
method.apply(args);
const char* prop_name = object->getPropertyName(prop);
if (prop_name) {
args.setItem(0, Py::String(prop_name));
method.apply(args);
}
}
else {
Py::Callable method(feature.getAttr(std::string("onBeforeChange")));
Py::Tuple args(2);
args.setItem(0, Py::Object(object->getPyObject(), true));
std::string prop_name = object->getPropertyName(prop);
args.setItem(1, Py::String(prop_name));
method.apply(args);
const char* prop_name = object->getPropertyName(prop);
if (prop_name) {
args.setItem(1, Py::String(prop_name));
method.apply(args);
}
}
}
}
@@ -141,17 +145,21 @@ void FeaturePythonImp::onChanged(const Property* prop)
if (feature.hasAttr("__object__")) {
Py::Callable method(feature.getAttr(std::string("onChanged")));
Py::Tuple args(1);
std::string prop_name = object->getPropertyName(prop);
args.setItem(0, Py::String(prop_name));
method.apply(args);
const char* prop_name = object->getPropertyName(prop);
if (prop_name) {
args.setItem(0, Py::String(prop_name));
method.apply(args);
}
}
else {
Py::Callable method(feature.getAttr(std::string("onChanged")));
Py::Tuple args(2);
args.setItem(0, Py::Object(object->getPyObject(), true));
std::string prop_name = object->getPropertyName(prop);
args.setItem(1, Py::String(prop_name));
method.apply(args);
const char* prop_name = object->getPropertyName(prop);
if (prop_name) {
args.setItem(1, Py::String(prop_name));
method.apply(args);
}
}
}
}
@@ -643,17 +643,21 @@ void ViewProviderPythonFeatureImp::onChanged(const App::Property* prop)
if (vp.hasAttr("__object__")) {
Py::Callable method(vp.getAttr(std::string("onChanged")));
Py::Tuple args(1);
std::string prop_name = object->getPropertyName(prop);
args.setItem(0, Py::String(prop_name));
method.apply(args);
const char* prop_name = object->getPropertyName(prop);
if (prop_name) {
args.setItem(0, Py::String(prop_name));
method.apply(args);
}
}
else {
Py::Callable method(vp.getAttr(std::string("onChanged")));
Py::Tuple args(2);
args.setItem(0, Py::Object(object->getPyObject(), true));
std::string prop_name = object->getPropertyName(prop);
args.setItem(1, Py::String(prop_name));
method.apply(args);
const char* prop_name = object->getPropertyName(prop);
if (prop_name) {
args.setItem(1, Py::String(prop_name));
method.apply(args);
}
}
}
}

0 comments on commit aa0f6b5

Please sign in to comment.
You can’t perform that action at this time.