Print Page | Close Window

TQuickPDF.Create crash if CoInitialize not called

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=2049
Printed Date: 21 Sep 24 at 4:21AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: TQuickPDF.Create crash if CoInitialize not called
Posted By: TJoe(J^)
Subject: TQuickPDF.Create crash if CoInitialize not called
Date Posted: 21 Nov 11 at 4:09AM
TQuickPDF.Create crash if CoInitialize not called:

QuickPDF Verison: 8.12

Issue: TQuickPDF.Create blows chunks if called from an application that does not first call CoInitialize(), raising an EOleSysError "CoInitialized has not been called" exception.

Cause: The latest versions of the QuickPDF library calls CreateOleObject() and makes an assumption that the calling application will make the calls to CoInitialize() and CoUninitialize() in behalf of the library. Previous QuickPDF versions (7) seem unaffected.

Replication: Call TQuickPDF.Create from any application where CoInitialize() has not first been called.

Delphi 6 example:

program Project1;

uses
  QuickPDF;

var
  FPdfEngine : TQuickPDF;
begin
//  CoInitialize(nil);
  FPdfEngine := TQuickPDF.Create;
  try
    FPdfEngine.Free;
  except
  end;
//  CoUninitialize();
end.

Workaround: Call CoInitialize() before using the QuickPDF library and call CoUninitialize() after its use.




Replies:
Posted By: TJoe(J^)
Date Posted: 21 Nov 11 at 4:12AM
Not all programming languages might support this workaround.


Posted By: Ingo
Date Posted: 21 Nov 11 at 8:53AM
Hi Joe!
 
I didn't check this out but if you're right you should post this to the official support pages, too.
 
Cheers, Ingo


Posted By: AndrewC
Date Posted: 21 Nov 11 at 12:28PM
I have passed this onto the developers and hopefully we can find a quick fix for the 8.13 release.


Posted By: AndrewC
Date Posted: 08 Dec 11 at 1:08AM
We have added a whole lot of code to the 8.14 beta 1 release that should overcome the the CoInitialize problem.  Beta testers are very welcome.

  http://www.quickpdflibrary.com/blog/2011/12/quick-pdf-library-8-14-beta-1-released/

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