Skip to content

Commit

Permalink
fix memory leak on IGES import
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Apr 3, 2017
1 parent a289538 commit add9bf9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Mod/Import/App/AppImportPy.cpp
Expand Up @@ -41,9 +41,11 @@
# include <IGESControl_Controller.hxx>
# include <IGESData_GlobalSection.hxx>
# include <IGESData_IGESModel.hxx>
# include <IGESToBRep_Actor.hxx>
# include <Interface_Static.hxx>
# include <Transfer_TransientProcess.hxx>
# include <XSControl_WorkSession.hxx>
# include <XSControl_TransferReader.hxx>
# include <APIHeaderSection_MakeHeader.hxx>
# include <OSD_Exception.hxx>
#endif
Expand Down Expand Up @@ -164,6 +166,9 @@ class Module : public Py::ExtensionModule<Module>
pi->Show();
aReader.Transfer(hDoc);
pi->EndScope();
// http://opencascade.blogspot.de/2009/03/unnoticeable-memory-leaks-part-2.html
Handle(IGESToBRep_Actor)::DownCast(aReader.WS()->TransferReader()->Actor())
->SetModel(new IGESData_IGESModel);
}
catch (OSD_Exception) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Expand Down
8 changes: 8 additions & 0 deletions src/Mod/Import/Gui/AppImportGuiPy.cpp
Expand Up @@ -52,9 +52,11 @@
# include <IGESControl_Controller.hxx>
# include <IGESData_GlobalSection.hxx>
# include <IGESData_IGESModel.hxx>
# include <IGESToBRep_Actor.hxx>
# include <Interface_Static.hxx>
# include <Transfer_TransientProcess.hxx>
# include <XSControl_WorkSession.hxx>
# include <XSControl_TransferReader.hxx>
# include <TopTools_IndexedMapOfShape.hxx>
# include <TopTools_MapOfShape.hxx>
# include <TopExp_Explorer.hxx>
Expand Down Expand Up @@ -391,6 +393,9 @@ class Module : public Py::ExtensionModule<Module>
pi->Show();
aReader.Transfer(hDoc);
pi->EndScope();
// http://opencascade.blogspot.de/2009/03/unnoticeable-memory-leaks-part-2.html
Handle(IGESToBRep_Actor)::DownCast(aReader.WS()->TransferReader()->Actor())
->SetModel(new IGESData_IGESModel);
}
catch (OSD_Exception) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Expand Down Expand Up @@ -565,6 +570,9 @@ class Module : public Py::ExtensionModule<Module>
pi->Show();
aReader.Transfer(hDoc);
pi->EndScope();
// http://opencascade.blogspot.de/2009/03/unnoticeable-memory-leaks-part-2.html
Handle(IGESToBRep_Actor)::DownCast(aReader.WS()->TransferReader()->Actor())
->SetModel(new IGESData_IGESModel);
}
else {
throw Py::Exception(Base::BaseExceptionFreeCADError, "no supported file format");
Expand Down

0 comments on commit add9bf9

Please sign in to comment.