diff --git a/src/Gui/GuiApplication.cpp b/src/Gui/GuiApplication.cpp
index 4f738afd4..eb7801544 100644
--- a/src/Gui/GuiApplication.cpp
+++ b/src/Gui/GuiApplication.cpp
@@ -73,6 +73,7 @@ bool GUIApplication::notify (QObject * receiver, QEvent * event)
if (!receiver) {
Base::Console().Log("GUIApplication::notify: Unexpected null receiver, event type: %d\n",
(int)event->type());
+ return false;
}
try {
if (event->type() == Spaceball::ButtonEvent::ButtonEventType ||
diff --git a/src/Gui/Selection.cpp b/src/Gui/Selection.cpp
index cfefc5854..d7936701f 100644
--- a/src/Gui/Selection.cpp
+++ b/src/Gui/Selection.cpp
@@ -38,7 +38,6 @@
#include "Document.h"
#include "Selection.h"
#include "SelectionFilter.h"
-#include "SelectionObjectPy.h"
#include "View3DInventor.h"
#include
#include
@@ -47,6 +46,7 @@
#include
#include
#include
+#include
#include "MainWindow.h"
@@ -981,6 +981,7 @@ SelectionSingleton::SelectionSingleton()
hz = 0;
ActiveGate = 0;
App::GetApplication().signalDeletedObject.connect(boost::bind(&Gui::SelectionSingleton::slotDeletedObject, this, _1));
+ CurrentPreselection.Type = SelectionChanges::ClrSelection;
CurrentPreselection.pDocName = 0;
CurrentPreselection.pObjectName = 0;
CurrentPreselection.pSubName = 0;
diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp
index 427d9f3c6..ba337b887 100644
--- a/src/Gui/View3DInventorViewer.cpp
+++ b/src/Gui/View3DInventorViewer.cpp
@@ -841,9 +841,10 @@ void View3DInventorViewer::setNavigationType(Base::Type t)
}
NavigationStyle* ns = static_cast(base);
- ns->operator = (*this->navigation);
- if (this->navigation)
+ if (this->navigation) {
ns->operator = (*this->navigation);
+ delete this->navigation;
+ }
this->navigation = ns;
this->navigation->setViewer(this);
}
diff --git a/src/Mod/Drawing/Gui/TaskOrthoViews.cpp b/src/Mod/Drawing/Gui/TaskOrthoViews.cpp
index cda34471e..10d20ef44 100644
--- a/src/Mod/Drawing/Gui/TaskOrthoViews.cpp
+++ b/src/Mod/Drawing/Gui/TaskOrthoViews.cpp
@@ -273,6 +273,9 @@ void orthoview::set_projection(gp_Ax2 cs)
OrthoViews::OrthoViews(App::Document* doc, const char * pagename, const char * partname)
{
+ horiz = 0;
+ vert = 0;
+
parent_doc = doc;
parent_doc->openTransaction("Create view");
diff --git a/src/Mod/Fem/App/FemMeshPyImp.cpp b/src/Mod/Fem/App/FemMeshPyImp.cpp
index 6bbd5dc29..40510d054 100644
--- a/src/Mod/Fem/App/FemMeshPyImp.cpp
+++ b/src/Mod/Fem/App/FemMeshPyImp.cpp
@@ -232,22 +232,21 @@ PyObject* FemMeshPy::addEdge(PyObject *args)
SMESHDS_Mesh* meshDS = mesh->GetMeshDS();
int n1,n2;
- if (!PyArg_ParseTuple(args, "ii",&n1,&n2))
- return 0;
-
- try {
- const SMDS_MeshNode* node1 = meshDS->FindNode(n1);
- const SMDS_MeshNode* node2 = meshDS->FindNode(n2);
- if (!node1 || !node2)
- throw std::runtime_error("Failed to get node of the given indices");
- SMDS_MeshEdge* edge = meshDS->AddEdge(node1, node2);
- if (!edge)
- throw std::runtime_error("Failed to add edge");
- return Py::new_reference_to(Py::Int(edge->GetID()));
- }
- catch (const std::exception& e) {
- PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
- return 0;
+ if (PyArg_ParseTuple(args, "ii",&n1,&n2)) {
+ try {
+ const SMDS_MeshNode* node1 = meshDS->FindNode(n1);
+ const SMDS_MeshNode* node2 = meshDS->FindNode(n2);
+ if (!node1 || !node2)
+ throw std::runtime_error("Failed to get node of the given indices");
+ SMDS_MeshEdge* edge = meshDS->AddEdge(node1, node2);
+ if (!edge)
+ throw std::runtime_error("Failed to add edge");
+ return Py::new_reference_to(Py::Int(edge->GetID()));
+ }
+ catch (const std::exception& e) {
+ PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
+ return 0;
+ }
}
PyErr_Clear();
@@ -281,20 +280,21 @@ PyObject* FemMeshPy::addEdge(PyObject *args)
default:
throw std::runtime_error("Unknown node count, [2|3] are allowed"); //unknown edge type
}
- }else{
+ }
+ else {
switch(Nodes.size()){
- case 2:
- edge = meshDS->AddEdge(Nodes[0],Nodes[1]);
- if (!edge)
- throw std::runtime_error("Failed to add edge");
- break;
- case 3:
- edge = meshDS->AddEdge(Nodes[0],Nodes[1],Nodes[2]);
- if (!edge)
- throw std::runtime_error("Failed to add edge");
- break;
- default:
- throw std::runtime_error("Unknown node count, [2|3] are allowed"); //unknown edge type
+ case 2:
+ edge = meshDS->AddEdge(Nodes[0],Nodes[1]);
+ if (!edge)
+ throw std::runtime_error("Failed to add edge");
+ break;
+ case 3:
+ edge = meshDS->AddEdge(Nodes[0],Nodes[1],Nodes[2]);
+ if (!edge)
+ throw std::runtime_error("Failed to add edge");
+ break;
+ default:
+ throw std::runtime_error("Unknown node count, [2|3] are allowed"); //unknown edge type
}
}
return Py::new_reference_to(Py::Int(edge->GetID()));
diff --git a/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.cpp b/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.cpp
index e1637881c..73ae7f453 100644
--- a/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.cpp
+++ b/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.cpp
@@ -52,7 +52,7 @@ using namespace FemGui;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
TaskDlgMeshShapeNetgen::TaskDlgMeshShapeNetgen(FemGui::ViewProviderFemMeshShapeNetgen *obj)
- : TaskDialog(),ViewProviderFemMeshShapeNetgen(obj)
+ : TaskDialog(), param(0), ViewProviderFemMeshShapeNetgen(obj)
{
FemMeshShapeNetgenObject = dynamic_cast(obj->getObject());
if (FemMeshShapeNetgenObject) {
diff --git a/src/Mod/Inspection/Gui/ViewProviderInspection.cpp b/src/Mod/Inspection/Gui/ViewProviderInspection.cpp
index df0e5b10c..f8a644e34 100644
--- a/src/Mod/Inspection/Gui/ViewProviderInspection.cpp
+++ b/src/Mod/Inspection/Gui/ViewProviderInspection.cpp
@@ -183,7 +183,7 @@ void ViewProviderInspection::updateData(const App::Property* prop)
{
// set to the expected size
if (prop->getTypeId() == App::PropertyLink::getClassTypeId()) {
- App::GeoFeature* object = dynamic_cast(prop)->getValue();
+ App::GeoFeature* object = static_cast(prop)->getValue();
if (object) {
float accuracy=0;
Base::Type meshId = Base::Type::fromName("Mesh::Feature");
diff --git a/src/Mod/Part/App/Attacher.cpp b/src/Mod/Part/App/Attacher.cpp
index c809bde64..df1e4bb28 100644
--- a/src/Mod/Part/App/Attacher.cpp
+++ b/src/Mod/Part/App/Attacher.cpp
@@ -1639,9 +1639,6 @@ Base::Placement AttachEngineLine::calculateAttachedPlacement(Base::Placement ori
switch (mmode) {
- case mmDeactivated:
- //should have been filtered out already!
- break;
case mm1AxisInertia1:
case mm1AxisInertia2:
case mm1AxisInertia3:{
@@ -1802,7 +1799,7 @@ Base::Placement AttachEngineLine::calculateAttachedPlacement(Base::Placement ori
//=================================================================================
-TYPESYSTEM_SOURCE(Attacher::AttachEnginePoint, Attacher::AttachEngine);
+TYPESYSTEM_SOURCE(Attacher::AttachEnginePoint, Attacher::AttachEngine)
AttachEnginePoint::AttachEnginePoint()
{
@@ -1874,7 +1871,7 @@ Base::Placement AttachEnginePoint::calculateAttachedPlacement(Base::Placement or
std::vector types;
readLinks(this->references, parts, shapes, copiedShapeStorage, types);
- if (parts.size() == 0)
+ if (parts.empty())
throw ExceptionCancel();
@@ -1884,9 +1881,6 @@ Base::Placement AttachEnginePoint::calculateAttachedPlacement(Base::Placement or
switch (mmode) {
- case mmDeactivated:
- //should have been filtered out already!
- break;
case mm0Vertex:{
std::vector points;
assert(shapes.size()>0);
diff --git a/src/Mod/Part/Gui/ViewProviderBoolean.cpp b/src/Mod/Part/Gui/ViewProviderBoolean.cpp
index 399698678..e4cac431a 100644
--- a/src/Mod/Part/Gui/ViewProviderBoolean.cpp
+++ b/src/Mod/Part/Gui/ViewProviderBoolean.cpp
@@ -86,9 +86,11 @@ void ViewProviderBoolean::updateData(const App::Property* prop)
if (hist.size() != 2)
return;
Part::Boolean* objBool = dynamic_cast(getObject());
+ if (!objBool)
+ return;
Part::Feature* objBase = dynamic_cast(objBool->Base.getValue());
Part::Feature* objTool = dynamic_cast(objBool->Tool.getValue());
- if (objBool && objBase && objTool) {
+ if (objBase && objTool) {
const TopoDS_Shape& baseShape = objBase->Shape.getValue();
const TopoDS_Shape& toolShape = objTool->Shape.getValue();
const TopoDS_Shape& boolShape = objBool->Shape.getValue();
diff --git a/src/Mod/Part/Gui/ViewProviderCurveNet.cpp b/src/Mod/Part/Gui/ViewProviderCurveNet.cpp
index 40e64aac1..b29de2067 100644
--- a/src/Mod/Part/Gui/ViewProviderCurveNet.cpp
+++ b/src/Mod/Part/Gui/ViewProviderCurveNet.cpp
@@ -67,7 +67,7 @@ PROPERTY_SOURCE(PartGui::ViewProviderCurveNet,PartGui::ViewProviderPart)
ViewProviderCurveNet::ViewProviderCurveNet()
- : bInEdit(false),bMovePointMode(false)
+ : bInEdit(false),bMovePointMode(false),EdgeRoot(0),VertexRoot(0)
{
LineWidth.setValue(4.0f);
PointSize.setValue(0.05f);
diff --git a/src/Mod/Part/Gui/ViewProviderMirror.cpp b/src/Mod/Part/Gui/ViewProviderMirror.cpp
index 27c0bfd1b..35da705c2 100644
--- a/src/Mod/Part/Gui/ViewProviderMirror.cpp
+++ b/src/Mod/Part/Gui/ViewProviderMirror.cpp
@@ -239,8 +239,10 @@ void ViewProviderFillet::updateData(const App::Property* prop)
if (hist.size() != 1)
return;
Part::Fillet* objFill = dynamic_cast(getObject());
+ if (!objFill)
+ return;
Part::Feature* objBase = dynamic_cast(objFill->Base.getValue());
- if (objFill && objBase) {
+ if (objBase) {
const TopoDS_Shape& baseShape = objBase->Shape.getValue();
const TopoDS_Shape& fillShape = objFill->Shape.getValue();
@@ -342,8 +344,10 @@ void ViewProviderChamfer::updateData(const App::Property* prop)
if (hist.size() != 1)
return;
Part::Chamfer* objCham = dynamic_cast(getObject());
+ if (!objCham)
+ return;
Part::Feature* objBase = dynamic_cast(objCham->Base.getValue());
- if (objCham && objBase) {
+ if (objBase) {
const TopoDS_Shape& baseShape = objBase->Shape.getValue();
const TopoDS_Shape& chamShape = objCham->Shape.getValue();
diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp
index 293dcdbde..763fbc9e1 100644
--- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp
+++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp
@@ -2602,7 +2602,7 @@ private:
{
// We will approximate the ellipse as a sequence of connected chords
// Number of points per quadrant of the ellipse
- double n = static_cast((editCurve.size() - 1) / 4);
+ int n = static_cast((editCurve.size() - 1) / 4);
// We choose points in the perifocal frame then translate them to sketch cartesian.
// This gives us a better approximation of an ellipse, i.e. more points where the
@@ -2661,7 +2661,7 @@ private:
*/
void ellipseToOctave(Base::Vector2D /*onSketchPos*/)
{
- double n = static_cast((editCurve.size() - 1) / 4);
+ int n = static_cast((editCurve.size() - 1) / 4);
// send a GNU Octave script to stdout to plot points for debugging
std::ostringstream octave;