Skip to content

Commit

Permalink
Merge branch 'master' into bug/4466
Browse files Browse the repository at this point in the history
  • Loading branch information
sliptonic committed Dec 18, 2020
2 parents 9ea837f + 5cea165 commit b2e993e
Show file tree
Hide file tree
Showing 12 changed files with 461 additions and 447 deletions.
2 changes: 2 additions & 0 deletions src/Gui/Document.cpp
Expand Up @@ -1189,6 +1189,8 @@ bool Document::saveAs(void)
escapedstr = Base::Tools::escapeEncodeFilename(escapedstr);
Command::doCommand(Command::Doc,"App.getDocument(\"%s\").saveAs(u\"%s\")"
, DocName, escapedstr.c_str());
// App::Document::saveAs() may modify the passed file name
fi.setFile(QString::fromUtf8(d->_pcDocument->FileName.getValue()));
setModified(false);
getMainWindow()->appendRecentFile(fi.filePath());
}
Expand Down
12 changes: 12 additions & 0 deletions src/Gui/TaskView/TaskDialogPython.cpp
Expand Up @@ -337,8 +337,20 @@ TaskDialogPython::~TaskDialogPython()
std::vector< QPointer<QWidget> > guarded;
guarded.insert(guarded.begin(), Content.begin(), Content.end());
Content.clear();

Base::PyGILStateLocker lock;

// The widgets stored in the 'form' attribute will be deleted.
// Thus, set this attribute to None to make sure that when using
// the same dialog instance for a task panel won't segfault.
if (this->dlg.hasAttr(std::string("form"))) {
this->dlg.setAttr(std::string("form"), Py::None());
}
this->dlg = Py::None();

// Assigning None to 'dlg' may destroy some of the stored widgets.
// By guarding them with QPointer their pointers will be set to null
// so that the destructor of the base class can reliably call 'delete'.
Content.insert(Content.begin(), guarded.begin(), guarded.end());
}

Expand Down

0 comments on commit b2e993e

Please sign in to comment.