[TD]fix crash on delete while dialog open (#18120)
This commit is contained in:
committed by
Chris Hennes
parent
806663d579
commit
50c9c910ea
@@ -76,6 +76,7 @@ TaskProjGroup::TaskProjGroup(TechDraw::DrawView* featView, bool mode) :
|
||||
ui->setupUi(this);
|
||||
|
||||
m_page = view->findParentPage();
|
||||
m_viewName = view->getNameInDocument();
|
||||
Gui::Document* activeGui = Gui::Application::Instance->getDocument(m_page->getDocument());
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(m_page);
|
||||
auto* dvp = static_cast<ViewProviderPage*>(vp);
|
||||
@@ -797,10 +798,15 @@ bool TaskProjGroup::apply()
|
||||
|
||||
bool TaskProjGroup::accept()
|
||||
{
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument(view->getDocument());
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument(m_page->getDocument());
|
||||
if (!doc) {
|
||||
return false;
|
||||
}
|
||||
auto viewCheck = m_page->getDocument()->getObject(m_viewName.c_str());
|
||||
if (!viewCheck) {
|
||||
// view has been deleted while this dialog is open
|
||||
return false;
|
||||
}
|
||||
|
||||
if (multiView) {
|
||||
multiView->recomputeChildren();
|
||||
@@ -814,11 +820,17 @@ bool TaskProjGroup::accept()
|
||||
|
||||
bool TaskProjGroup::reject()
|
||||
{
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument(view->getDocument());
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument(m_page->getDocument());
|
||||
if (!doc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto viewCheck = m_page->getDocument()->getObject(m_viewName.c_str());
|
||||
if (!viewCheck) {
|
||||
// view has been deleted while this dialog is open
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getCreateMode()) {
|
||||
//remove the object completely from the document
|
||||
const char* viewName = view->getNameInDocument();
|
||||
|
||||
@@ -116,6 +116,7 @@ private:
|
||||
TechDraw::DrawView* view;
|
||||
TechDraw::DrawProjGroup* multiView;
|
||||
bool m_createMode;
|
||||
std::string m_viewName;
|
||||
|
||||
bool blockUpdate{true};
|
||||
bool blockCheckboxes;
|
||||
|
||||
Reference in New Issue
Block a user