[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: MFC question: is it really necessary to call DeleteObject?

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: 2007-10-10 07:42:34 CEST

On 10/10/07, Andreas Nicolai <Andreas.Nicolai@gmx.net> wrote:
> Hi there,
>
> after creating a font
>
> CFont myFont;
> myFont.CreatePointFont(...);
>
> and setting a font to the device context with
>
> CFont * oldFont = dc.SelectObject(&myFont);
>
> and restoring it with
>
> dc.SelectObject(oldFont);
>
> do I really have to delete the object with
>
> myFont.DeleteObject();
>
> as it is written in the MFC docs?
>
> If that is really necessary it has been forgotten many times in the
> MyGraph.cpp.

Yes, and that's one of the reasons MyGraph.cpp is slow and can run out
of GDI objects.
You have to delete those objects manually.
(btw: if you like to replace MyGraph.cpp, that would be great!)

Stefan

-- 
       ___
  oo  // \\      "De Chelonian Mobile"
 (_,\/ \_/ \     TortoiseSVN
   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
   /_/   \_\     http://tortoisesvn.net
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Wed Oct 10 07:42:38 2007

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.