Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Avoid issue if ViewProvider deleted while graphic still active
  • Loading branch information
WandererFan committed Jan 30, 2017
1 parent 49c2be1 commit 5f72efa
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Mod/TechDraw/Gui/MDIViewPage.cpp
Expand Up @@ -481,7 +481,7 @@ void MDIViewPage::redraw1View(TechDraw::DrawView* dv)
std::string dvName = dv->getNameInDocument();
const std::vector<QGIView *> &upviews = m_view->getViews();
for(std::vector<QGIView *>::const_iterator it = upviews.begin(); it != upviews.end(); ++it) {
std::string qgivName = (*it)->getViewObject()->getNameInDocument();
std::string qgivName = (*it)->getViewName();
if(dvName == qgivName) {
(*it)->updateView(true);
}
Expand Down Expand Up @@ -517,7 +517,7 @@ bool MDIViewPage::hasQView(App::DocumentObject *obj)

while(qview != views.end()) {
// Unsure if we can compare pointers so rely on name
if(strcmp((*qview)->getViewObject()->getNameInDocument(), obj->getNameInDocument()) == 0) {
if(strcmp((*qview)->getViewName(), obj->getNameInDocument()) == 0) {
return true;
}
qview++;
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/TechDraw/Gui/QGIProjGroup.cpp
Expand Up @@ -181,9 +181,9 @@ void QGIProjGroup::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
Gui::Command::openCommand("Drag Projection Group");
//TODO: See if these commands actually handle the horizontal/vertical constraints properly...
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.X = %f",
getViewObject()->getNameInDocument(), Rez::appX(x()));
getViewName(), Rez::appX(x()));
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Y = %f",
getViewObject()->getNameInDocument(), Rez::appX(getY()));// inverts Y
getViewName(), Rez::appX(getY()));// inverts Y
Gui::Command::commitCommand();
//Gui::Command::updateActive();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/TechDraw/Gui/QGIViewSymbol.cpp
Expand Up @@ -135,7 +135,7 @@ void QGIViewSymbol::symbolToSvg(QByteArray qba)

prepareGeometryChange();
if (!m_svgItem->load(&qba)) {
Base::Console().Error("Error - Could not load Symbol into SVG renderer for %s\n", getViewObject()->getNameInDocument());
Base::Console().Error("Error - Could not load Symbol into SVG renderer for %s\n", getViewName());
}
m_svgItem->centerAt(0.,0.);
}
6 changes: 2 additions & 4 deletions src/Mod/TechDraw/Gui/QGVPage.cpp
Expand Up @@ -417,8 +417,7 @@ QGIView * QGVPage::findView(App::DocumentObject *obj) const
if(obj) {
const std::vector<QGIView *> qviews = views;
for(std::vector<QGIView *>::const_iterator it = qviews.begin(); it != qviews.end(); ++it) {
TechDraw::DrawView *fview = (*it)->getViewObject();
if(fview && strcmp(obj->getNameInDocument(), fview->getNameInDocument()) == 0)
if(strcmp(obj->getNameInDocument(), (*it)->getViewName()) == 0)
return *it;
}
}
Expand All @@ -441,8 +440,7 @@ QGIView * QGVPage::findParent(QGIView *view) const
std::vector<App::DocumentObject *> objs = dim->References2D.getValues();
// Attach the dimension to the first object's group
for(std::vector<QGIView *>::const_iterator it = qviews.begin(); it != qviews.end(); ++it) {
TechDraw::DrawView *viewObj = (*it)->getViewObject();
if(strcmp(viewObj->getNameInDocument(), objs.at(0)->getNameInDocument()) == 0) {
if(strcmp((*it)->getViewName(), objs.at(0)->getNameInDocument()) == 0) {
return *it;
}
}
Expand Down

0 comments on commit 5f72efa

Please sign in to comment.