Re: Problem (dispose?) MDI forms
- From: SealedClassSingleton <SealedClassSingleton@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 16 Mar 2007 07:20:03 -0700
I don't call the close myselft. It's done by the tabbedMDI interface from
Janus (www.janusys.com). It looks like a tab where eveyry form is represented
on a seperate tabpage.
I don't think it's related to them, because I use these controls in a number
of projects and it don't have similar problems. It looks like in this case
the notification to the mdiparent gets lost...
"VJ" wrote:
Very tricky. I truly agree. Have developed MDI apps for last few years as.
programmer. I don't like solutions like these, but sometimes after close
you can just set the object to null.
One thing tho'.. if you tabbed MDI, how is a child Form in a tab?, and you
do frm.Close().. and I am assuming you remove the Tab. Just curious on those
steps..!
VJ
"SealedClassSingleton" <Eagle@xxxxxxxxxxxxxxxx> wrote in message
news:FDADA37E-82F9-44D8-B3BB-9A28CCF86761@xxxxxxxxxxxxxxxx
I agree that closing a form doens't mean that the form is immediate
released,
but the problem is a little more subtile: I'm sure that the form is
disposed
(I put some code in the destructor), but it remains accessible through the
mdilist and in the midichildren property. As far as I know, no addtional
child are created inside the form (I additionaly even check if all
controls
are removed...)
I agree, that it could take a while to be GCed (depending on memory
consumption / load and other things) but once a form is closed it
shouldn't
be accessible anymore (In my situation is even worde bacause I'm using a
tabbed mdi interface and the users stills sees the "closed" window in the
MDI
tab. Clicking on it generates the exception)...
"VJ" wrote:
Sure.. Close does not mean the object is immediately available to be
garbage
collected and disposed. There is still other objects created by child
Form2
in memory, as long as all of it are not cleared Form2 will exist. Now
these
are not limited to Child form controls, they can be threads or any other
objects created when Form2 i.e. child was in memory and working...
HTH
VJ
"SealedClassSingleton" <Eagle@xxxxxxxxxxxxxxxx> wrote in message
news:3238DC52-45DD-4B33-93F0-DA6A19AAAEA0@xxxxxxxxxxxxxxxx
Hi,
I've a very weird error in an MDI application. From time to time, when
closing a child form, the form is closed correctly (put some writelines
on
different places: form_closing / form_closed / dispose) but is not
removed
from the MDIparent.
When I iterate over all child forms I can close the form a second time
(?)
even all controls are already disposed.
When clicking on the "closed" form in the MDI list, I get an
ObjectDisposed
Exception.
A first chance exception of type 'System.ObjectDisposedException'
occurred
in System.Windows.Forms.dll
System.ObjectDisposedException: Cannot access a disposed object.
Anyone who had similar problems ? Suggestions ?
- Follow-Ups:
- Re: Problem (dispose?) MDI forms
- From: VJ
- Re: Problem (dispose?) MDI forms
- References:
- Re: Problem (dispose?) MDI forms
- From: VJ
- Re: Problem (dispose?) MDI forms
- From: VJ
- Re: Problem (dispose?) MDI forms
- Prev by Date: Re: Problem (dispose?) MDI forms
- Next by Date: Re: Problem (dispose?) MDI forms
- Previous by thread: Re: Problem (dispose?) MDI forms
- Next by thread: Re: Problem (dispose?) MDI forms
- Index(es):
Relevant Pages
|