[TD]prevent fail during document restore

This commit is contained in:
wandererfan
2023-12-23 08:56:09 -05:00
committed by WandererFan
parent 8d51d78ce7
commit 43d8fa81f5
2 changed files with 20 additions and 1 deletions

View File

@@ -148,6 +148,19 @@ void QGIViewPart::updateView(bool update)
void QGIViewPart::draw()
{
auto viewPart(dynamic_cast<TechDraw::DrawViewPart*>(getViewObject()));
if (!viewPart) {
return;
}
auto doc = viewPart->getDocument();
if (!doc || doc->testStatus(App::Document::Status::Restoring)) {
// if the document is still restoring, we may not have all the information
// we need to draw the source objects, so we wait until restore is finished.
// Base::Console().Message("QGIVP::draw - document is restoring, do not draw\n");
return;
}
if (!isVisible())
return;
@@ -697,6 +710,7 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b
void QGIViewPart::drawComplexSectionLine(TechDraw::DrawViewSection* viewSection, bool b)
{
Q_UNUSED(b);
TechDraw::DrawViewPart* viewPart = static_cast<TechDraw::DrawViewPart*>(getViewObject());
if (!viewPart)
return;