1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-05 07:15:39 +02:00

new method finalize().

This commit is contained in:
Alain Magloire 2002-11-25 05:55:31 +00:00
parent af142b433e
commit 561066c167
2 changed files with 35 additions and 5 deletions

View file

@ -30,12 +30,27 @@ public class AR {
public void dispose() { public void dispose() {
try try
{ {
efile.close(); if (efile != null)
{
efile.close();
efile = null;
}
} }
catch( IOException e ) catch( IOException e )
{} {}
} }
protected void finalize() throws Throwable {
try
{
dispose();
}
finally
{
super.finalize();
}
}
/** /**
* The <code>ARHeader</code> class is used to store the per-object file * The <code>ARHeader</code> class is used to store the per-object file
* archive headers. It can also create an Elf object for inspecting * archive headers. It can also create an Elf object for inspecting

View file

@ -687,15 +687,30 @@ public class Elf {
} }
public void dispose() { public void dispose() {
if ( addr2line != null ) { if (addr2line != null) {
addr2line.dispose(); addr2line.dispose();
} }
if ( cppFilt != null ) { if (cppFilt != null) {
cppFilt.dispose(); cppFilt.dispose();
} }
try { try {
efile.close(); if (efile != null) {
} catch (IOException e) {} efile.close();
efile = null;
}
} catch (IOException e) {
}
}
/**
* Make sure we do not leak the fds.
*/
protected void finalize() throws Throwable {
try {
dispose();
} finally {
super.finalize();
}
} }
public Section[] getSections(int type) throws IOException { public Section[] getSections(int type) throws IOException {