Skip to content

Commit

Permalink
[TD]prevent running threads on object delete
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Aug 18, 2022
1 parent 74cdc6d commit 2d7d882
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Mod/TechDraw/App/DrawViewDetail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ DrawViewDetail::DrawViewDetail() :

DrawViewDetail::~DrawViewDetail()
{
//don't delete this object while it still has dependent tasks running
if (m_detailFuture.isRunning()) {
Base::Console().Message("%s is waiting for detail cut to finish\n", getNameInDocument());
m_detailFuture.waitForFinished();
}
}

short DrawViewDetail::mustExecute() const
Expand Down
9 changes: 9 additions & 0 deletions src/Mod/TechDraw/App/DrawViewPart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ DrawViewPart::DrawViewPart(void) :

DrawViewPart::~DrawViewPart()
{
//don't delete this object while it still has dependent threads running
if (m_hlrFuture.isRunning()) {
Base::Console().Message("%s is waiting for HLR to finish\n", getNameInDocument());
m_hlrFuture.waitForFinished();
}
if (m_faceFuture.isRunning()) {
Base::Console().Message("%S is waiting for face finding to finish\n", getNameInDocument());
m_faceFuture.waitForFinished();
}
removeAllReferencesFromGeom();
delete geometryObject;
}
Expand Down
5 changes: 5 additions & 0 deletions src/Mod/TechDraw/App/DrawViewSection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ DrawViewSection::DrawViewSection() :

DrawViewSection::~DrawViewSection()
{
//don't destroy this object while it has dependent threads running
if (m_cutFuture.isRunning()) {
Base::Console().Message("%s is waiting for tasks to complete\n", getNameInDocument());
m_cutFuture.waitForFinished();
}
}

short DrawViewSection::mustExecute() const
Expand Down

0 comments on commit 2d7d882

Please sign in to comment.