Generated PDF file lock not released before callback fired

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Generated PDF file lock not released before callback fired

Postby santiagoIT » Fri Sep 23, 2016 9:39 am

Hi there,

This is a problem I have run into using CEFSharp, which is really just a simple .NET wrapper around CEF.

The problem is that if you try to access the generated PDF file directly after the callback function has been fired an IO exception is raised indicating that the file is still in use. When CEF fires the CefPdfPrintCallback::OnPdfPrintFinished callback the file lock on the generated PDF file has not yet been released.
If you however wait for a few ms before attempting to access the generated PDF file, it then works -> NO IO.Exception.

Windows 10 x64, CefSharp v51.0.0.
Problem could be reproduced with both the regular and offscreen browsers.

Is this expected behaviour/as designed?

To me it seems like a bug, it would be better if the file lock is released before the callback is executed.

Here is the link to the issue I filed for the CefSharp project with some more information.

https://github.com/cefsharp/CefSharp/issues/1807#issuecomment-249059697

Thank you!
santiagoIT
Newbie
 
Posts: 1
Joined: Fri Sep 23, 2016 9:23 am

Re: Generated PDF file lock not released before callback fir

Postby magreenblatt » Mon Sep 26, 2016 10:26 am

What CEF version? Is it only a problem when you try to delete or move the file, or also to read the file?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Generated PDF file lock not released before callback fir

Postby sigh71 » Thu Oct 26, 2017 9:47 pm

I am experiencing this problem now with CEF 59 used with CEFGlue.
I am only attempting to read the file.
Code: Select all
using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))


It is especially repeatable if you create 2 pdfs from two different browsers in quick succession, the first will not be locked, but the second will be locked in the callback.
sigh71
Newbie
 
Posts: 1
Joined: Thu Oct 26, 2017 9:42 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 45 guests