Forms deletes itself

R

RFOG

Hello all!

I've a bunch of forms that I create on app startup. But sometimes they are
auto disposed. I don't understand why, because I instantiate them by gcnew
and does not delete until app ends.

--
Visita mi blog principal: http://rfog.blogsome.com
Y este sobre programación: http://geeks.ms/blogs/rfog
Libros, ciencia ficción y programación
========================================
Donde las dan las toman, y callar es bueno.
 
R

RFOG

Hello all!

I've a bunch of forms that I create on app startup. But sometimes they
are auto disposed. I don't understand why, because I instantiate them by
gcnew and does not delete until app ends.
I think I've resolved the issue.

It is related to a Windows Forms timer, if form is closed and timer fires
and closes the form, the form is distroyed.


--
Visita mi blog principal: http://rfog.blogsome.com
Y este sobre programación: http://geeks.ms/blogs/rfog
Libros, ciencia ficción y programación
========================================
Donde las dan las toman, y callar es bueno.
 
B

Ben Voigt

Because they are garbage collected objects, if they become unreachable, they
will be finalized and the memory reclaimed, even though you don't call
delete.
 
R

RFOG

Is any way to elude this?

Because they are garbage collected objects, if they become unreachable,
they
will be finalized and the memory reclaimed, even though you don't call
delete.



--
Visita mi blog principal: http://rfog.blogsome.com
Y este sobre programación: http://geeks.ms/blogs/rfog
Libros, ciencia ficción y programación
========================================
Oye Patxi, ¿que le pasa a la mula que viene llorando?
Nada, que me ha pegado una coz y se la he devuelto.
 
R

RFOG

Yes, thank you.

:)

Make sure they stay reachable from a gc rooted object, like a static
variable in some class.



--
Visita mi blog principal: http://rfog.blogsome.com
Y este sobre programación: http://geeks.ms/blogs/rfog
Libros, ciencia ficción y programación
========================================
La tragedia de la edad no es ser viejo, sino que se sea joven y la gente
no lo vea.
-- Andrés Segovia.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top