Article View: borland.public.jbuilder.java.language
Article #19964Closing Window with dispose. How safe?
From: John Papadomichelakis
Date: Wed, 19 Nov 1997 00:00
Date: Wed, 19 Nov 1997 00:00
69 lines
2485 bytes
2485 bytes
This is a multi-part message in MIME format.
--------------654D9C8E835BC63B3733030E
Content-Type: text/plain; charset=iso-8859-7
Content-Transfer-Encoding: 7bit
Hi Javers....
One Question which (I guess) it's easy to answer to someone familiar
with Java.
The following function opens the window iw_st_families.
The iw_st_families is an class variable that holds the pointer to
window.
In the Window I call the dispose() function to destroy the object.
But... the object is not destroyed. On a setVisible(true) is enough to
bring it back to life.
I know that this is an incorrect approach and in C++, it could cause a
GPF since the iw_st_families points to memory address that
no longer belongs to the iw_st_families.
However here seems to work correctly.
Since there is always a variable that points to that address, will the
garbage collection destroy ever that object?
void m_st_families_actionPerformed(ActionEvent e) {
if(iw_st_families==null){
iw_st_families = new w_st_families();
iw_st_families.validate();
iw_st_families.setVisible(true);
} else {
iw_st_families.setVisible(true);
}
}
}
--
Papadomichelakis John
"Unite for Java! - http://www.javalobby.org"
__________________________________________________
email : michelos@freemail.gr
URL : http://users.spark.net.gr:8080/~michelos/
TEL : 30 31 758 429, 30 31 709 796
__________________________________________________
--------------654D9C8E835BC63B3733030E
Content-Type: text/x-vcard; charset=iso-8859-7; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for John Papadomichelakis
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: John Papadomichelakis
n: Papadomichelakis;John
org: BIA
adr: 9 Filippou;;Euosmos;Thessaloniki;;56224;Greece
email;internet: michelos@freemail.gr
x-mozilla-cpt: ;0
x-mozilla-html: TRUE
version: 2.1
end: vcard
--------------654D9C8E835BC63B3733030E--
Technical Details
Message-ID:
<34735DD3.B5C855E7@freemail.gr>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,9213d76c0e673f46,start X-Google-Attributes: gidf74b3,public From: John Papadomichelakis <michelos@freemail.gr> Subject: Closing Window with dispose. How safe? Date: 1997/11/19 Message-ID: <34735DD3.B5C855E7@freemail.gr> X-Deja-AN: 290827862 Organization: None Newsgroups: borland.public.jbuilder.java.language