|
![](/i/fill.gif) |
> Some of the Microsoft API libraries are starting to have rather sparse
> documentation. They have things like "Components.Add(aComponent) adds the
> component to the components list." They don't mention "Oh, and by the
> way, if the enclosing object has already been initialized, then this will
> invoke Initialize() on your component automatically. If the enclosing
> object hasn't been initialized, this will invoke Initialize() after the
> enclosing object invokes Initialize() but before that invokation returns."
>
> You don't want to initialize things twice, but you also don't get told
> if/where it is the system does it for you.
Back when I was doing C++/DirectX stuff I remember things like this. The
documentation didn't mention whether objects were getting released by
functions or not. If you used one object to create another, could you then
release the first object? Or when you finally released the second one, did
it release the first one for you?
In the end trial and error using the debug libraries sorted out most leaks.
It had a cool feature where each object was given a number and then when
your program exited it gave a list of numbers that weren't released. You
could then set the debug library to break when an object with that number
was created - it was then obvious (most of the time) what you had
forgotten/not realised to release.
Post a reply to this message
|
![](/i/fill.gif) |