Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - GetCanvasDc Cleanup
  FAQ FAQ  Forum Search   Register Register  Login Login

GetCanvasDc Cleanup

 Post Reply Post Reply
Author
Message
jpbro View Drop Down
Senior Member
Senior Member


Joined: 29 Mar 11
Status: Offline
Points: 77
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Topic: GetCanvasDc Cleanup
    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.
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
jpbro View Drop Down
Senior Member
Senior Member


Joined: 29 Mar 11
Status: Offline
Points: 77
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
jpbro View Drop Down
Senior Member
Senior Member


Joined: 29 Mar 11
Status: Offline
Points: 77
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
jpbro View Drop Down
Senior Member
Senior Member


Joined: 29 Mar 11
Status: Offline
Points: 77
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
jpbro View Drop Down
Senior Member
Senior Member


Joined: 29 Mar 11
Status: Offline
Points: 77
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 08 Dec 11 at 3:16PM
Great, thanks for the information Andrew.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store