mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
new method finalize().
This commit is contained in:
parent
af142b433e
commit
561066c167
2 changed files with 35 additions and 5 deletions
|
@ -30,12 +30,27 @@ public class AR {
|
|||
public void dispose() {
|
||||
try
|
||||
{
|
||||
efile.close();
|
||||
if (efile != null)
|
||||
{
|
||||
efile.close();
|
||||
efile = null;
|
||||
}
|
||||
}
|
||||
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
|
||||
* archive headers. It can also create an Elf object for inspecting
|
||||
|
|
|
@ -687,15 +687,30 @@ public class Elf {
|
|||
}
|
||||
|
||||
public void dispose() {
|
||||
if ( addr2line != null ) {
|
||||
if (addr2line != null) {
|
||||
addr2line.dispose();
|
||||
}
|
||||
if ( cppFilt != null ) {
|
||||
if (cppFilt != null) {
|
||||
cppFilt.dispose();
|
||||
}
|
||||
try {
|
||||
efile.close();
|
||||
} catch (IOException e) {}
|
||||
if (efile != null) {
|
||||
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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue