Archived issue #0026381
OSD_File - close file on destruction
Description
Current implementation of OSD_File keeps file opened on destruction which might lead to memory leaks or file locks.
Since this behavior is unusual (e.g. std::ofstream closes file on destruction) it would be better to fix this to avoid possible errors.
Since this behavior is unusual (e.g. std::ofstream closes file on destruction) it would be better to fix this to avoid possible errors.
Steps to reproduce
Not required
Public activity
14 archived notes
Participants are labeled by their role within this record.
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: akz
Date: Fri Sep 25 13:44:41 2015 +0300
0026381: OSD_File - close file on destruction
Add destructor for OSD_File, that unlocks and close file.
[revision removed]
Detailed log of new commits:
Author: akz
Date: Fri Sep 25 13:44:41 2015 +0300
0026381: OSD_File - close file on destruction
Add destructor for OSD_File, that unlocks and close file.
Branch CR26381 is ready for review
I suppose that the following check:
might lead to exception during destruction of empty OSD_File.
764 Standard_Boolean OSD_File::IsOpen()const{
765
766 if (myPath.Name().Length()==0)
767 Standard_ProgramError::Raise("OSD_File::IsOpen : empty file name");
might lead to exception during destruction of empty OSD_File.
Is this check kind of linux specific? Cause code for windows does not contain such check in the same functions.
IsOpen() anyway returns False, if file path is empty. Do we really need to throw exception here?
IsOpen() anyway returns False, if file path is empty. Do we really need to throw exception here?
I believe raising exception there is senseless and should be removed
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Senseless checks were removed from IsOpen(), IsLocked() and GetLock().
Branch CR26381 was updated.
Branch CR26381 was updated.
Branch [archived branch] has been updated by Participant.
[revision removed]
Detailed log of new commits:
Author: abv
Date: Fri Sep 25 19:27:25 2015 +0300
Destructor of OSD_FileNode is made protected to avoid possibility of deleting descendants by pointer to base class
[revision removed]
Detailed log of new commits:
Author: abv
Date: Fri Sep 25 19:27:25 2015 +0300
Destructor of OSD_FileNode is made protected to avoid possibility of deleting descendants by pointer to base class
Reviewed and corrected; please test
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been rebased on the current master
Dear Commenter 1,
Branch CR26381 from occt git-repository (and master from products git-repository) was compiled on Linux and Windows platforms and tested.
[revision removed]
Number of compiler warnings:
occt component:
Linux: 13 (13 on master)
Windows: 0 (0 on master)
products component:
Linux: 39 (39 on master)
Windows: 0 (0 on master)
Regressions/Differences:
Not detected
Testing cases:
Not needed
Testing on Linux:
Total MEMORY difference: 93373001 / 93274110 [+0.11%]
Total CPU difference: 19437.86999999933 / 19594.749999999236 [-0.80%]
Testing on Windows:
Total MEMORY difference: 57926411 / 57934407 [-0.01%]
Total CPU difference: 17980.987261999133 / 17727.251635499077 [+1.43%]
Branch CR26381 from occt git-repository (and master from products git-repository) was compiled on Linux and Windows platforms and tested.
[revision removed]
Number of compiler warnings:
occt component:
Linux: 13 (13 on master)
Windows: 0 (0 on master)
products component:
Linux: 39 (39 on master)
Windows: 0 (0 on master)
Regressions/Differences:
Not detected
Testing cases:
Not needed
Testing on Linux:
Total MEMORY difference: 93373001 / 93274110 [+0.11%]
Total CPU difference: 19437.86999999933 / 19594.749999999236 [-0.80%]
Testing on Windows:
Total MEMORY difference: 57926411 / 57934407 [-0.01%]
Total CPU difference: 17980.987261999133 / 17727.251635499077 [+1.43%]
Branch [archived branch] has been deleted by Author.
[revision removed]
[revision removed]