Program Crashing - I think because of NullRef

Cheetah

Well-known member
Joined
Oct 12, 2006
Messages
232
Programming Experience
Beginner
Hi there,

Basically I have an object [obj y] that has event [evnt x].

When event [evnt x] is raised, I want to destroy (via .dispose) the object [obj y] that raised it.

I think this is what is causing my program to crash - is there anyway around this - to allow me to destroy the object [obj y] when or after event [evnt x] has been raised.

Thinking about it whilst I am writing this - I could add it to a bin and get a timer to check the bin and clear it, but is there a better way?

The reason I want to do this is because the object is said to have memory leaks and it was advised to dispose the object and set it to null to avoid the leaks.

I think my description is pretty clear, but if you still need code (its pretty messy), then just ask.

Thanks.

EDIT:

Since this event only happens every couple of minutes...will it be best to just do it on a new thread and abort the thread at the end?
 
Last edited:
Back
Top