Jump to content
Software FX Community

Correct object destruction


User (Legacy)

Recommended Posts

Do I need to worry about object descruction?

I am using ChartFX client server in MFC and have noticed in the

DestroyWindow method:

BOOL CCfxXYChart::DestroyWindow()

{

// TODO: Add your specialized code here and/or call the base class

m_pChartFX = NULL;

return CDialog::DestroyWindow();

}

There is a setting of the object to NULL, but no releasing of the object

or anything else. Do I need to worry?

A program that I use to detect memory leaks is reporting that some

memory is being leaked when running the MFC sample.

Link to comment
Share on other sites

If the chart is inside a container, it will automatically be destroyed when 

the container is destroyed assuming you don't have any COM references to it

(AddRef, QueryInterface), if you use smart pointers, the Release calls will

occur automatically when the C++ object is deleted (destructor is called)

Setting the Smart Pointer to null will also cause a Release, as a matter of

fact you can debug this and check the return value of the Release call, the

last one should return ZERO (0), if it is not zero it means you still have a

reference.

--

FP

Software FX

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...