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!
![]() |
GetCanvasDc Cleanup |
Post Reply
|
| Author | |
jpbro
Senior Member
Joined: 29 Mar 11 Status: Offline Points: 77 |
Post Options
Thanks(0)
Quote Reply
Topic: GetCanvasDc CleanupPosted: 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. |
|
![]() |
|
AndrewC
Moderator Group
Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
Quote Reply
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.
|
|
![]() |
|
jpbro
Senior Member
Joined: 29 Mar 11 Status: Offline Points: 77 |
Post Options
Thanks(0)
Quote Reply
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.
|
|
![]() |
|
jpbro
Senior Member
Joined: 29 Mar 11 Status: Offline Points: 77 |
Post Options
Thanks(0)
Quote Reply
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. |
|
![]() |
|
jpbro
Senior Member
Joined: 29 Mar 11 Status: Offline Points: 77 |
Post Options
Thanks(0)
Quote Reply
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?
|
|
![]() |
|
AndrewC
Moderator Group
Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
Quote Reply
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.
|
|
![]() |
|
jpbro
Senior Member
Joined: 29 Mar 11 Status: Offline Points: 77 |
Post Options
Thanks(0)
Quote Reply
Posted: 08 Dec 11 at 3:16PM |
|
Great, thanks for the information Andrew.
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store