I am tracking down a memory leak. So I wanna make sure
I got everything right...
I have an AbstractDialog class with
void AbstractDialog::OnPaint()
{
CPaintDC dc(this);
OnDraw(dc);
}
void AbstractDialog::OnDraw( CPaintDC& dc )
{
}
and each Dialog can now easily override the OnDraw method.
AFAIU overriding OnPaint() is not a good idea if you have
a deeper inheritance because the paint message should only
be sent once. Now in my dialog class I have e.g.:
void MyDialog::OnDraw( CPaintDC& dc )
{
CDC memDC;
memDC.CreateCompatibleDC(&dc);
...
memDC.DeleteDC();
}
IIUC omitting the DeleteDC() call would give a GDI memory
leak, right? ...but the CPaintDC will be deleted from it's
destructor, right?