From d43c16a144b842910956f70bcf4255e5ff7019b9 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Tue, 3 Feb 2015 09:07:44 +0100 Subject: [PATCH] Put destructors private or protected to prevent use of delete instead of decrRef. --- src/MEDLoader/MEDFileField.hxx | 5 +++++ src/MEDLoader/MEDFileMesh.hxx | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index c6059fea9..2e6884734 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -749,6 +749,7 @@ namespace ParaMEDMEM const MEDFileField1TSWithoutSDA *contentNotNull() const; MEDFileField1TSWithoutSDA *contentNotNull(); private: + ~MEDFileField1TS() { } MEDFileField1TS(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms); MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms); MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms); @@ -784,6 +785,7 @@ namespace ParaMEDMEM const MEDFileIntField1TSWithoutSDA *contentNotNull() const; MEDFileIntField1TSWithoutSDA *contentNotNull(); private: + ~MEDFileIntField1TS() { } MEDFileIntField1TS(); MEDFileIntField1TS(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms); MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms); @@ -1032,6 +1034,7 @@ namespace ParaMEDMEM const MEDFileFieldMultiTSWithoutSDA *contentNotNull() const; MEDFileFieldMultiTSWithoutSDA *contentNotNull(); private: + ~MEDFileFieldMultiTS() { } MEDFileFieldMultiTS(); MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); MEDFileFieldMultiTS(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms); @@ -1068,6 +1071,7 @@ namespace ParaMEDMEM const MEDFileIntFieldMultiTSWithoutSDA *contentNotNull() const; MEDFileIntFieldMultiTSWithoutSDA *contentNotNull(); private: + ~MEDFileIntFieldMultiTS() { } MEDFileIntFieldMultiTS(); MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms); @@ -1140,6 +1144,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); private: + ~MEDFileFields() { } MEDFileFields(); MEDFileFields(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms); private: diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index 7a76c0fe6..c895bc1c2 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -211,7 +211,6 @@ namespace ParaMEDMEM MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; MEDLOADER_EXPORT void clearNonDiscrAttributes() const; MEDLOADER_EXPORT void setName(const std::string& name); - MEDLOADER_EXPORT ~MEDFileUMesh(); // MEDLOADER_EXPORT int getMaxAbsFamilyIdInArrays() const; MEDLOADER_EXPORT int getMaxFamilyIdInArrays() const; @@ -286,6 +285,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell); MEDLOADER_EXPORT DataArrayInt *zipCoords(); private: + MEDLOADER_EXPORT ~MEDFileUMesh(); void writeLL(med_idt fid) const; MEDFileUMesh(); MEDFileUMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); @@ -349,6 +349,7 @@ namespace ParaMEDMEM // tools MEDLOADER_EXPORT bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell); protected: + ~MEDFileStructuredMesh() { } void changeFamilyIdArr(int oldId, int newId); void deepCpyAttributes(); void loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); @@ -395,6 +396,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT const MEDCouplingCMesh *getMesh() const; MEDLOADER_EXPORT void setMesh(MEDCouplingCMesh *m); private: + ~MEDFileCMesh() { } const MEDCouplingStructuredMesh *getStructuredMesh() const; void writeLL(med_idt fid) const; MEDFileCMesh(); @@ -425,6 +427,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT const MEDCouplingCurveLinearMesh *getMesh() const; MEDLOADER_EXPORT void setMesh(MEDCouplingCurveLinearMesh *m); private: + ~MEDFileCurveLinearMesh() { } MEDFileCurveLinearMesh(); MEDFileCurveLinearMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); const MEDCouplingStructuredMesh *getStructuredMesh() const; @@ -452,6 +455,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const; MEDLOADER_EXPORT void setOneTimeStep(MEDFileMesh *mesh1TimeStep); private: + ~MEDFileMeshMultiTS() { } void loadFromFile(const std::string& fileName, const std::string& mName); MEDFileMeshMultiTS(); MEDFileMeshMultiTS(const std::string& fileName); @@ -486,6 +490,7 @@ namespace ParaMEDMEM MEDLOADER_EXPORT void setMeshAtPos(int i, MEDFileMesh *mesh); MEDLOADER_EXPORT void destroyMeshAtPos(int i); private: + ~MEDFileMeshes() { } void checkCoherency() const; void loadFromFile(const std::string& fileName); MEDFileMeshes(); -- 2.39.2