Coverity issues:

129097
129098
129099
129101
129102
129132
129134
129203
This commit is contained in:
wmayer 2016-08-16 16:34:51 +02:00
parent 58bf4ca455
commit ab525189bf
6 changed files with 24 additions and 13 deletions

View File

@ -812,13 +812,13 @@ void StdCmdToggleSelectability::activated(int iMsg)
for (std::vector<App::DocumentObject*>::const_iterator ft=sel.begin();ft!=sel.end();++ft) {
ViewProvider *pr = pcDoc->getViewProviderByName((*ft)->getNameInDocument());
if(pr->isDerivedFrom(ViewProviderGeometryObject::getClassTypeId())){
if (dynamic_cast<ViewProviderGeometryObject*>(pr)->Selectable.getValue())
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Selectable=False"
, (*it)->getName(), (*ft)->getNameInDocument());
else
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Selectable=True"
, (*it)->getName(), (*ft)->getNameInDocument());
if (pr->isDerivedFrom(ViewProviderGeometryObject::getClassTypeId())){
if (static_cast<ViewProviderGeometryObject*>(pr)->Selectable.getValue())
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Selectable=False"
, (*it)->getName(), (*ft)->getNameInDocument());
else
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Selectable=True"
, (*it)->getName(), (*ft)->getNameInDocument());
}
}
}

View File

@ -306,6 +306,8 @@ void DlgCustomActionsImp::on_buttonReplaceAction_clicked()
CommandManager& rclMan = Application::Instance->commandManager();
Command* pCmd = rclMan.getCommandByName(actionName.constData());
MacroCommand* macro = dynamic_cast<MacroCommand*>(pCmd);
if (!macro)
return;
if (!actionWhatsThis->text().isEmpty())
macro->setWhatsThis(actionWhatsThis->text().toUtf8());

View File

@ -219,8 +219,13 @@ bool Document::setEdit(Gui::ViewProvider* p, int ModNum)
{
if (d->_editViewProvider)
resetEdit();
// is it really a ViewProvider of this document?
if (d->_ViewProviderMap.find(dynamic_cast<ViewProviderDocumentObject*>(p)->getObject()) == d->_ViewProviderMap.end())
ViewProviderDocumentObject* vp = dynamic_cast<ViewProviderDocumentObject*>(p);
if (!vp)
return false;
if (d->_ViewProviderMap.find(vp->getObject()) == d->_ViewProviderMap.end())
return false;
View3DInventor *activeView = dynamic_cast<View3DInventor *>(getActiveView());
@ -1044,7 +1049,7 @@ void Document::createView(const Base::Type& typeId)
View3DInventor* firstView = 0;
QGLWidget* shareWidget = 0;
if (!theViews.empty()) {
firstView = dynamic_cast<View3DInventor*>(theViews.front());
firstView = static_cast<View3DInventor*>(theViews.front());
shareWidget = qobject_cast<QGLWidget*>(firstView->getViewer()->getGLWidget());
}

View File

@ -70,7 +70,7 @@ GUIApplication::~GUIApplication()
bool GUIApplication::notify (QObject * receiver, QEvent * event)
{
if (!receiver && event) {
if (!receiver) {
Base::Console().Log("GUIApplication::notify: Unexpected null receiver, event type: %d\n",
(int)event->type());
}

View File

@ -841,7 +841,8 @@ void View3DInventorViewer::setNavigationType(Base::Type t)
NavigationStyle* ns = static_cast<NavigationStyle*>(base);
ns->operator = (*this->navigation);
delete this->navigation;
if (this->navigation)
ns->operator = (*this->navigation);
this->navigation = ns;
this->navigation->setViewer(this);
}

View File

@ -390,8 +390,11 @@ QWidget* WidgetFactoryInst::createPrefWidget(const char* sName, QWidget* parent,
w->setParent(parent);
try {
dynamic_cast<PrefWidget*>(w)->setEntryName(sPref);
dynamic_cast<PrefWidget*>(w)->restorePreferences();
PrefWidget* pw = dynamic_cast<PrefWidget*>(w);
if (pw) {
pw->setEntryName(sPref);
pw->restorePreferences();
}
}
catch (...) {
#ifdef FC_DEBUG