diff --git a/src/Base/Interpreter.cpp b/src/Base/Interpreter.cpp index 812b7c625..b5f4f0f27 100644 --- a/src/Base/Interpreter.cpp +++ b/src/Base/Interpreter.cpp @@ -273,10 +273,13 @@ void InterpreterSingleton::runFile(const char*pxFileName, bool local) dict = PyDict_Copy(dict); if (PyDict_GetItemString(dict, "__file__") == NULL) { PyObject *f = PyString_FromString(pxFileName); - if (f == NULL) + if (f == NULL) { + fclose(fp); return; + } if (PyDict_SetItemString(dict, "__file__", f) < 0) { Py_DECREF(f); + fclose(fp); return; } Py_DECREF(f); diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 31ec53ceb..62ba88f7b 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -910,7 +910,7 @@ void StdCmdSetAppearance::activated(int iMsg) bool StdCmdSetAppearance::isActive(void) { - return Gui::Selection().size() != 0; + return !Gui::Selection().empty(); } //=========================================================================== diff --git a/src/Gui/PythonDebugger.cpp b/src/Gui/PythonDebugger.cpp index 45952dc60..ab4102868 100644 --- a/src/Gui/PythonDebugger.cpp +++ b/src/Gui/PythonDebugger.cpp @@ -435,10 +435,13 @@ void PythonDebugger::runFile(const QString& fn) dict = PyDict_Copy(dict); if (PyDict_GetItemString(dict, "__file__") == NULL) { PyObject *f = PyString_FromString((const char*)pxFileName); - if (f == NULL) + if (f == NULL) { + fclose(fp); return; + } if (PyDict_SetItemString(dict, "__file__", f) < 0) { Py_DECREF(f); + fclose(fp); return; } Py_DECREF(f); diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraint.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraint.cpp index 0668c05f8..c9eab5060 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraint.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraint.cpp @@ -433,7 +433,8 @@ void ViewProviderFemConstraint::checkForWizard() QWidget* wd = sa->widget(); // This is the reason why we cannot use findChildByName() right away!!! if (wd == NULL) return; QObject* wiz = findChildByName(wd, QObject::tr("ShaftWizard")); // FIXME: Actually, we don't want to translate this... - if (wiz != NULL) + if (wiz != NULL) { wizardWidget = static_cast(wiz); - wizardSubLayout = wiz->findChild(QObject::tr("ShaftWizardLayout")); + wizardSubLayout = wiz->findChild(QObject::tr("ShaftWizardLayout")); + } }