Print Page | Close Window

GetCanvasDc Cleanup

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1999
Printed Date: 16 Dec 25 at 8:57PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: GetCanvasDc Cleanup
Posted By: jpbro
Subject: GetCanvasDc Cleanup
Date Posted: 14 Oct 11 at 10:13PM
After getting a DC handle with GetCanvasDC, do we have to call DeleteDC to cleanup, or does LoadFromCanvasDC handle cleanup? What if we call GetCanvasDc but for some reason, we do not subsequently call LoadFromCavasDc - would we have to call DeleteDC then? This is for Qpdf 7.26.

Thanks for any clarifications.



Replies:
Posted By: AndrewC
Date Posted: 17 Oct 11 at 3:09PM
Looking at the QPL source code I see that a TMetaFile is actually created with the GetCanvasDC function and the DC from the Metafile is the return value.  This TMetafile  class is only released when LoadFromCanvasDC is called which then releases the DC.

It looks like these two calls must me called in pairs, GetCanvasDC  to create the MetaFile and then cleanly release it when finished.


Posted By: jpbro
Date Posted: 17 Oct 11 at 10:07PM
Thanks a lot Andrew, I will make sure that LoadFromCanvasDC is called in my Class_Terminate event if I've previously called GetCanvasDC to ensure proper cleanup.


Posted By: jpbro
Date Posted: 09 Nov 11 at 11:42PM
What about after calling CapturePage? Do we need to cleanup by calling anything? The document doesn't say, but I'm trying to track some memory leaks in my software, so I'm investigating every possibility (BTW, I'm using QPDF 7.26)

Thanks for any advice.


Posted By: jpbro
Date Posted: 30 Nov 11 at 2:02PM
Hi Andrew - any chance you could get back to me on this? Is there any cleanup required after calling CapturePage, or does calling DrawCapturedPage release the capture page handle?


Posted By: AndrewC
Date Posted: 08 Dec 11 at 1:10AM
As stated earlier these two calls need to be paired.  ie.  Call one then the other and then the resources should be freed automatically.

If you only call CapturePage then there may be some memory that is not freed until the program is closed.

Andrew.


Posted By: jpbro
Date Posted: 08 Dec 11 at 3:16PM
Great, thanks for the information Andrew.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk